For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > February 2005 > interpreting a $var as a command









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author interpreting a $var as a command
Florian Prud'homme

2005-01-30, 8:55 pm

Hello,

do you know a way how to execute a string like a command ? (I think
it's something related to variable interpolation).


I want to have the same effect as :

print " Hello world\n";


with a variable like

$toto="print \" Hello world\n\"";


thanks.
Florian
kevindotcar

2005-02-08, 3:55 pm

Florian Prud'homme wrote:
> Hello,
>
> do you know a way how to execute a string like a command ? (I think
> it's something related to variable interpolation).
>
>
> I want to have the same effect as :
>
> print " Hello world\n";
>
>
> with a variable like
>
> $toto="print \" Hello world\n\"";
>
>
> thanks.
> Florian


perl -d
DB<1> $x = `ls -l`
DB<2> print $x
drwxr-xr-x 2 26241 everyone 0 Jan 19 17:04 old_logs

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com