Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

(Re:)**4 Can this If/Else be condensed into a 1 liner with a trailing If?

by bwana147 (Pilgrim)
on Oct 02, 2001 at 15:08 UTC ( [id://116148]=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 Re: Re: Re: Can this If/Else be condensed into a 1 liner with a trailing If?
in thread Can this If/Else be condensed into a 1 liner with a trailing If?

Actually, whithin a while (<STDIN>) {...}, the $_ contains the trailing \n. So even though a line might contain a lone zero, it will indeed be "0\n", which is definitely true.

--bwana147

Replies are listed 'Best First'.
Re: (Re:)**4 Can this If/Else be condensed into a 1 liner with a trailing If?
by Anonymous Monk on Oct 02, 2001 at 17:28 UTC
    But a textfile could be malformed and missing the \n at the end of the last line (most Windows text editors forget to put a \n at the end of the last line) thus $_ could contain "0"
      The question wasn't "can <STDIN> return FALSE" but rather "isn't there some magic built into while(<STDIN>) that makes it test for definedness instead of truthfullness?"

      -Blake

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://116148]
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.