Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Question re numbers and strings

by pat_mc (Pilgrim)
on Jan 13, 2011 at 09:05 UTC ( #882058=note: print w/replies, xml ) Need Help??


in reply to Question re numbers and strings

Clearly, Perl is trying to interpret as much of the string as a number as it can. For that reason, the following will also work:
my $field = 2; print "A number!", $field + 1 if ( $field > 1);
So despite the warning that $field is not numerical Perl does try to read the actual numerical value assigned.

Not sure if this is any help.

Pat

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://882058]
help
Chatterbox?
[choroba]: Aren't they the standard X colours?
[ambrus]: choroba: that's not clear, since Tk runs on systems that don't even have X.

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2017-10-17 11:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (227 votes). Check out past polls.

    Notices?