Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by nysus (Parson)
on Nov 21, 2017 at 19:52 UTC ( [id://1203944]=note: print w/replies, xml ) Need Help??


in reply to Re: Creating dispatch table with variable in function name
in thread Creating dispatch table with variable in function name

Ugh, forgot the ->() bit to actually call the function. The sub { "DUMMY" } output when printing the variable was also throwing me off.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re^3: Creating dispatch table with variable in function name
by choroba (Cardinal) on Nov 23, 2017 at 10:07 UTC
    Uf the sub { "DUMMY" } came from Data::Dumper, you can tell it to show the code by turning Deparse on:
    use Data::Dumper; $Data::Dumper::Deparse = 1; print Dumper(sub { $_[0] . $_[1] });

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-26 07:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found