Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by karlgoethebier (Curate)
on Sep 03, 2013 at 13:50 UTC ( #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»


Comment on Re^2: What does the dash before hash assignment means?
Download Code
Re^3: What does the dash before hash assignment means?
by Corion (Pope) 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
Node Status?
node history
Node Type: note [id://1052106]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2014-09-19 19:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (144 votes), past polls