Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: execute a string as a function

by choroba (Abbot)
on Aug 06, 2013 at 15:31 UTC ( #1048136=note: print w/ replies, xml ) Need Help??


in reply to execute a string as a function

Use a dispatch table:

my %dispatch = ( A => \&unpack_a, B => \&unpack_b, C => \&unpack_c, ); # ... $dispatch{$RECORD_SEQ_ID}->($lines[$_]);
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: execute a string as a function
Download Code
Re^2: execute a string as a function
by fionbarr (Pilgrim) on Aug 06, 2013 at 15:35 UTC
    thanks to both!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2014-12-26 11:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls