Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Probably an easy one - store command in variable.by rementis (Beadle) |
on Sep 15, 2005 at 16:35 UTC ( [id://492319]=perlquestion: print w/replies, xml ) | Need Help?? |
rementis has asked for the wisdom of the Perl Monks concerning the following question: OK, I've tried to do this just now using an anonymous subroutine, but I'm getting strange error messages. Here is my code:
Here is the error:
Here's an update: Here's the code I'm running now:
And here's the error:
Also, in case it matters, list contains exactly this: '1' , [ 'item1' , 0 ] , '2' , [ 'item2' , 0 ] , '3' , [ 'item3' , 0 ] , '4' , [ 'item4' , 0 ] , '5' , [ 'item5' , 0 ] , '6' , [ 'item6' , 0 ]Janitor note: Original content follows: Hello All-Knowing Monks,I need to execute a command that I have built in a variable, like this: If I print out the contents of $command I get exactly the line I want to execute, which looks like this: But if I put $command; on a line by itself, the contents of $command are not executed as a statement. Is there any way to make the contents of $command execute as a statement? Thanks in advance for any help!
Back to
Seekers of Perl Wisdom
|
|