Re: [MacPerl-AnyPerl] Re: macperl deletes lines ....
[email protected] (Ronald J Kimball) Wed, 20 Jun 2001 09:21:23 -0400
| Newsgroups | perl.macperl.anyperl |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Jun 20, 2001 at 10:04:13AM +0200, Sean Carte wrote: > Add this line to the beginning of the script: > > $/ = ''; > > That makes Perl ignore the newlines and makes the regexp work on the > entire file. Actually, setting $/ to '' puts Perl into paragraph mode, with blank lines (i.e. consecutive newlines) as the input separator. To ignore newlines completely, you need to set $/ to undef, either with: $/ = undef; or: undef $/; or, preferable: local $/; which will restore $/ back to its previous value at the end of the block. > The reason it's working in Linux is probably due to the line breaks > in the file not having been converted into native line-breaks: to > Linux the file consists of only one line. I think you're right about that. Ronald