|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Re: Until there's nothing but spaces?by gbarr (Monk) |
| on Oct 01, 2001 at 13:35 UTC ( [id://115862]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
Wow there have been several different responses to this
question, but not one has mentioned the operator that is
designed to do just what you ask, that is the
.. operator.
print if (/^Keyword$/../^\s*$/)||0 > 1 and /\S/; OK, so what does this do. Well the .. operator will return false until the LHS is true. It then returns a true value, this value will initially be 1 but will increment each time, until the RHS becomes true. But it will return true on the line where the RHS is true, so we add the /\S/ check to prevent the output of the last line. The || 0 is there as for false .. returns "", which -w will complain about.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||