Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: execute a string as a function

by choroba (Chancellor)
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[$_]);
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: execute a string as a function
by fionbarr (Friar) 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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2016-12-10 09:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (160 votes). Check out past polls.