Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
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.


in reply to Until there's nothing but spaces?

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://115862]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.