Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: What does the dash before hash assignment means?

by karlgoethebier (Abbot)
on Sep 03, 2013 at 13:50 UTC ( [id://1052106]=note: print w/replies, xml ) Need Help??


in reply to Re: What does the dash before hash assignment means?
in thread What does the dash before hash assignment means?

"...is not a hash assignment"

It is.

#!/usr/bin/env perl + use strict; use warnings; print fun(-nose =>'cuke') . qq(\n); sub fun { my %args = @_; return $args{-nose}; } __END__ karls-mac-mini:monks karl$ ./fun.pl cuke

«The Crux of the Biscuit is the Apostrophe»

Replies are listed 'Best First'.
Re^3: What does the dash before hash assignment means?
by Corion (Patriarch) on Sep 03, 2013 at 13:57 UTC

    Not really - the arguments to the function call construct a list:

    -nose =>'cuke' # even-sized list

    The hash assignment happens here:

    my %args = @_;

      OK, thats true.

      Thanks, Karl

      «The Crux of the Biscuit is the Apostrophe»

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found