in reply to Re^3: $/ question
in thread $/ question
You're setting a local value to $/ only inside the read loop. That is, the value gets set after the first record is read. At the end of the loop, it's set back to its default value ("\n"), and the next record is read with that value. Then inside the loop, you set the local value again. Try it this way:
sub slurpie { local $/ = ''; # paragraph mode while (<DATA>) { next unless /^\w\w.+(\w\w).+(\d+).+(\w\w)/sg; #should only ma +tch first paragraph print "$_\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: $/ question
by convenientstore (Pilgrim) on Jan 13, 2008 at 03:55 UTC | |
by kyle (Abbot) on Jan 13, 2008 at 04:13 UTC | |
by convenientstore (Pilgrim) on Jan 13, 2008 at 04:22 UTC |
In Section
Seekers of Perl Wisdom