Don't ask to ask, just ask | |
PerlMonks |
Re: This code is just freaky...by arturo (Vicar) |
on Jul 27, 2001 at 21:47 UTC ( [id://100390]=note: print w/replies, xml ) | Need Help?? |
It's a funky snippet that processes a certain block of lines in the file. Specifically, this code ignores lines between ones that contain "abcd" and ones that contain "def". The next tells you the code goes back to the block with the label LINE (so nothing in the loop below this line gets executed), and it does so while the following condition is true : from the point that $line matches "abcd" to the point where it matches "def" The range operator .. is the key here; notice that it occurs in scalar context, not list context. It's false until the regex on the left matches, where it flips to true, and remains true until the regex on the right matches. Read it as "everything in between" and you'll have a good idea of what's going on here (that works for how it operates in list context, too) This behavior is documented in perlop, under the heading "Range operators". HTH!
In Section
Seekers of Perl Wisdom
|
|