good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^3: Pulling lines from file, noob styleby xyzzy (Pilgrim) |
on Feb 17, 2010 at 17:43 UTC ( [id://823775]=note: print w/replies, xml ) | Need Help?? |
It picked up exactly what you asked, but it printed even when it didn't pick anything up. as you use Perl, your mind will assimilate to a more perlish way of procedural thinking. for instance, the same snippet could be written as
although the overall effect is the same as using an if statement the intention is more explicit: you don't care about the line unless it matches the regex. as perl takes over you mind, you should notice a decrease in errors of this sort $,=qq.\n.;print q.\/\/____\/.,q./\ \ / / \\.,q. /_/__.,q.. Happy, sober, smart: pick two.
In Section
Seekers of Perl Wisdom
|
|