http://www.perlmonks.org?node_id=1018600


in reply to Executing perl code

Just make sure nobody types "format c:" into that configuration script!

A much safer way to go about it is to read the config file and look up the provided command in a hash to make sure it is legit.

my ($cmd, @params) = split ',', <$inputFileHandle>; if (exists $hashOfAllowedCommands{$cmd}) { $worksheet->$hashOfAllowedCommands{$cmd}->(@params) }else{ print "Invalid command ignored in config file at line $.\n"; }

If you still want to play with the dynamite then take a look into eval