Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Why is this evaluating to true?

by lidden (Curate)
on Nov 16, 2011 at 13:04 UTC ( [id://938366]=note: print w/replies, xml ) Need Help??


in reply to Why is this evaluating to true?

The string "test" is zero when perl makes it numeric. I don't remember where that is documented but "test" is zero and e.g. "2test" is two.

Replies are listed 'Best First'.
Re^2: Why is this evaluating to true?
by SuicideJunkie (Vicar) on Nov 16, 2011 at 14:20 UTC

    You can use that feature for less-magic numbers in quick scripts. Eg:

    my $time = $minutes / '60 minutes per hour' / '8 hour workdays';
Re^2: Why is this evaluating to true?
by pmarcoen (Novice) on Nov 16, 2011 at 13:11 UTC
    Aha ! Thanks, good answer !

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-03-28 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found