in reply to Re: finding different linebreaks with <>
in thread finding different linebreaks with <>
#!/usr/bin/perl - w use strict; local $/="\cM"; my $file = $ARGV[0]; open my $fh, '<', $file or die $!; while(<$fh>){ print $_."\n"; }
I had to add the "\n" to the end of each line so that it printed out correctly in the unix system, the reason given by you guys
However, what if my file could be EITHER *nix/mac or windows, what's the best way to tell??
I'm hoping you can use a regular expression with the '$/' and do something like this:
local $/ = "[\n\r\cM]";
which then gets regexp for any or either, does that make sense?
Cheers
Sam
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: finding different linebreaks with <>
by hardburn (Abbot) on Apr 08, 2004 at 20:20 UTC | |
by Cody Pendant (Prior) on Apr 09, 2004 at 00:55 UTC | |
by seaver (Pilgrim) on Apr 08, 2004 at 20:38 UTC | |
|
Re: Re: Re: finding different linebreaks with <>
by tilly (Archbishop) on Apr 09, 2004 at 01:20 UTC | |
by seaver (Pilgrim) on Apr 09, 2004 at 16:39 UTC | |
by tilly (Archbishop) on Apr 09, 2004 at 18:15 UTC | |
by seaver (Pilgrim) on Apr 14, 2004 at 18:33 UTC | |
|
Re: Re: Re: finding different linebreaks with <>
by Anomynous Monk (Scribe) on Apr 08, 2004 at 23:07 UTC |