Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Use of the => operator

by gmpassos (Priest)
on Aug 10, 2004 at 00:00 UTC ( [id://381395]=note: print w/replies, xml ) Need Help??


in reply to Use of the => operator

When we have a non quoted word before the operator => we only can guarantee that this word won't be interpreted as a sub even when this sub exists. This doesn't mean that a number will be turned into a string, so, this is also valid:
%h = ( 1.000 => 'foo' ) ; print "value: $h{1}\n" ;
What make this valid:
$h{2.000} = 'bar' ; print "value: $h{2}\n" ;
What have nothing to do with the operator =>.

Graciliano M. P.
"Creativity is the expression of the liberty".

Replies are listed 'Best First'.
Re^2: Use of the => operator
by roju (Friar) on Aug 10, 2004 at 15:16 UTC
    From perlop: The => digraph is mostly just a synonym for the comma operator. It's useful for documenting arguments that come in pairs. As of release 5.001, it also forces any word to the left of it to be interpreted as a string.

    I'd call 01 a word, especially since 01 =~ /^\w+$/ will match. But yup, since perl defines Perl, 01 isn't a word ;)

      Maybe perlop need some updates!

      Graciliano M. P.
      "Creativity is the expression of the liberty".

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-25 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found