Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
There's more than one way to do things
 
PerlMonks  

Re^5: next unless - doesnt work?

by eyepopslikeamosquito (Canon)
on Apr 28, 2012 at 22:10 UTC ( #967871=note: print w/ replies, xml ) Need Help??


in reply to Re^4: next unless - doesnt work?
in thread next unless - doesnt work?

Not strange if you came from Unix shell, which also uses different operators for numeric versus string comparison. :)

Some background as to why Perl has string and numeric operators can be found in Modern Perl in the "Numeric, String, and Boolean Context" section on page eight:

In exchange for not having to declare (or at least track) explicitly what type of data a variable contains or a function produces, Perl offers specific type contexts that tell the compiler how to treat a given value during an operation ...

The eq operator treats its operands as strings by enforcing string context on them. The == operator imposes numeric context ...

Perl will do its best to coerce values to the proper type depending on the operators you use. Be sure to use the proper operator for the type of context you want.

This issue was discussed in gory detail a month ago in: Definition of numerically equal and rationale for 'you' == 'me'.


Comment on Re^5: next unless - doesnt work?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://967871]
help
Chatterbox?
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: (16)
As of 2013-05-22 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (454 votes), past polls