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

Re^2: HASH value as a subroutine call

by AnomalousMonk (Archbishop)
on Oct 21, 2012 at 11:46 UTC ( [id://1000210]=note: print w/replies, xml ) Need Help??


in reply to Re: HASH value as a subroutine call
in thread HASH value as a subroutine call

sub sum($$){...} # do you really need ($$) ? That is rarely useful.

Rarely useful, often misused, and in this case (in which prototypes are not checked at all) totally useless. E.g.:

>perl -wMstrict -le "sub sum ($$); ;; my $codes = { 'SOFT' => 'sum', 'HARD' => \&sum, }; ;; $codes->{HARD}->('HARD', 1, 2, 3, 4); ;; { no strict 'refs'; $codes->{SOFT}->('SOFT', 9, 8, 7, 6); } ;; sub sum ($$) { print qq{(@_) arguments: }, scalar @_; } " (HARD 1 2 3 4) arguments: 5 (SOFT 9 8 7 6) arguments: 5

Log In?
Username:
Password:

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

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

    No recent polls found