Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Creating dispatch table with variable in function name

by Laurent_R (Canon)
on Nov 22, 2017 at 19:04 UTC ( #1204059=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      DB<1> ($blue, $red) = qw / b r/;
    
      DB<2> say  ${$_} for qw /blue red/;
    b
    r
    
  2. or download this
    $ perl -Mstrict -E 'our ($blue, $red) = qw / b r/; say  ${$_} for qw /
    +blue red/;'
    Can't use string ("blue") as a SCALAR ref while "strict refs" in use a
    +t -e line 1.
    
  3. or download this
      DB<3> say ${ "bl" . "ue"};
    b
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2022-08-10 17:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?