in reply to About a piece of code
m/^\n/ is a regular expression that tries to match a newline (\n) at the beggining of the line (^). If there is such a match on the current value of $_, the code jumps back to the condition on the while loop, in this case reads one more line from the file.
So, this code is skipping blank lines on the file.
update as Marshall correctly points, the code skips lines that start with the \n disregarding whatever comes next.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: About a piece of code
by Marshall (Canon) on Aug 05, 2009 at 10:53 UTC | |
by jwkrahn (Abbot) on Aug 05, 2009 at 14:27 UTC | |
by Marshall (Canon) on Aug 05, 2009 at 15:47 UTC | |
by jwkrahn (Abbot) on Aug 05, 2009 at 19:10 UTC | |
by JadeNB (Chaplain) on Aug 05, 2009 at 21:57 UTC | |
Re^2: About a piece of code
by trewq (Initiate) on Aug 05, 2009 at 10:55 UTC | |
by olus (Curate) on Aug 05, 2009 at 11:14 UTC | |
by trewq (Initiate) on Aug 05, 2009 at 11:42 UTC | |
by ww (Archbishop) on Aug 05, 2009 at 13:01 UTC | |
by Anonymous Monk on Aug 05, 2009 at 12:00 UTC |
In Section
Seekers of Perl Wisdom