Argel has asked for the wisdom of the Perl Monks concerning the following question:
My other curiosity would be is there a way to split without having to resort to the map+chomp afterwards (while leaving the rest of the data intact)?# Doesn't DWIM $data =~ s/\012/\015/; $data =~ s/\015+/\015/; @records = split /\015/, $data;
Note: I realize only the 'm' option is necessary. The 'xs' are as per Perl Best Practices.# Works, but the map+chomp seems ugly @records = map {chomp $_; $_} split /^/xms, $data;
Thank you oh great wise ones!!
-- Argel
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Special behavior for LF and CR in RegExs?
by Aristotle (Chancellor) on Jan 05, 2006 at 00:55 UTC | |
by Argel (Prior) on Jan 05, 2006 at 01:19 UTC | |
by Aristotle (Chancellor) on Jan 05, 2006 at 01:39 UTC | |
by tye (Sage) on Jan 05, 2006 at 05:31 UTC | |
by Aristotle (Chancellor) on Jan 05, 2006 at 12:50 UTC | |
|
Re: Special behavior for LF and CR in RegExs?
by davidrw (Prior) on Jan 05, 2006 at 00:52 UTC |