Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Attempting to use $_ in "sub" inside "map"

by NetWallah (Canon)
on May 08, 2021 at 04:36 UTC ( #11132259=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    print $dispatch{"normal"}->(0),"\n"; # 0 Normal dispatch (as expected)
    + 
    print $dispatch{"Uno"}->(1),"\n";    #  WANT: "1 Sub returns Uno"
    print $dispatch{"Dos"}->(2),"\n";    #  WANT: "2 Sub returns Dos"
    
  2. or download this
    0 Normal dispatch
    Use of uninitialized value $_ in concatenation (.) or string at .\test
    +dispatch.pl line 5.
    1 Sub returns
    Use of uninitialized value $_ in concatenation (.) or string at .\test
    +dispatch.pl line 5.
    2 Sub returns
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11132259]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2022-01-19 19:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (55 votes). Check out past polls.

    Notices?