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

Re: execute a string as a function

by choroba (Canon)
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
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2015-08-01 03:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls