more useful options | |
PerlMonks |
Re^2: Match pattern per line and after another one as multiline in single file openingby kennethk (Abbot) |
on Feb 14, 2017 at 23:31 UTC ( [id://1182030]=note: print w/replies, xml ) | Need Help?? |
TIMTOWDI, but I would suggest you replace:
with The use of the for loop on a value you expect to be scalar confuses casual perusal, and you've declared the variable (my) at a different spot than where you initialize it. If you want to go compound, there's always but that feels crowded to me. If I were actually writing this, I would do: Slurping in a do loop keeps the filehandle tightly scoped and keeps that localization of the input file separator actually local. And note, even then, I personally prefer keeping the processing separate from the import. Update: Fixed typos; haukex++ Update: Fixed typos; haukex++. Some days you just shouldn't post code. #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
In Section
Seekers of Perl Wisdom
|
|