Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: what is benefit of unless ?

by holli (Monsignor)
on Feb 05, 2005 at 17:43 UTC ( #428351=note: print w/ replies, xml ) Need Help??

in reply to what is benefit of unless ?
in thread unless statements

$ cat input foo bar $ perl -ne 'print unless /^$/../^$/' input foo bar $ perl -ne 'print if not /^$/../^$/' input foo bar $ perl -ne 'print if ! /^$/../^$/' input foo bar
The unless statement is equivalent to if not, but is different from if ! due to the associativity and precedence rules covered in perlop. A benefit of this behavior allows the reduction of runs of blank lines to a single blank line.

taken from here

Comment on Re: what is benefit of unless ?
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://428351]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2015-11-27 02:54 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (714 votes), past polls