in reply to When is an ^$ not a ^$ ?
On the other hand, there are a couple of other approaches that are possible in this case. The first is to use my super-friend, the transliteration operator:
$file =~ tr/\r//d;
The other idea that comes to mind is a more complicated regex as an argument to split. I don't see this used often, which is a pity:
my @lines = split(/(?:\r?\n){2,}/, $file);
Take these with a grain of salt, because they could require some tweaking depending on your circumstances. Just remember that hammers in Perl usually have GPS and homing as well.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: When is an code^$/code not a code^$/code?
by Clownburner (Monk) on Apr 05, 2001 at 06:10 UTC | |
by jeroenes (Priest) on Apr 05, 2001 at 13:21 UTC | |
by Clownburner (Monk) on Apr 05, 2001 at 21:47 UTC | |
by jeroenes (Priest) on Apr 06, 2001 at 00:02 UTC |