Perl Monk, Perl Meditation | |
PerlMonks |
Re: why isn't split() working here?by roboticus (Chancellor) |
on Dec 09, 2010 at 03:39 UTC ( [id://876158]=note: print w/replies, xml ) | Need Help?? |
If you set $whole_file = "aaa\nbbb\nccc\nxxx\nyyy\xzzz"; in your first example, you'll see that it works there, too. I'd guess that you're on a windows box and your DATA section actually looks like: "aaa\r\nbbb\r\nccc\r\nxxx\r\nyyy\r\nzzz\r\n". If that's true, then changing your split expression to /xxx\r?\n/ or /xxx[\r\n]+/ might save the day for you. ...roboticus When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom
|
|