http://qs1969.pair.com?node_id=905040


in reply to Re^3: Executing a string as a Perl command
in thread Executing a string as a Perl command

This short illustrative example has $cmd set inline, but in a real program, it could be constructed from other variables, it could be read from a user, it could be read from a file, etc.

The question was simply how to get it to execute once it was set. The answer is eval.