For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > July 2004 > executing code that's inside a variable [Re: Code in Variable ausführen?]









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 executing code that's inside a variable [Re: Code in Variable ausführen?]
Philipp Traeder

2004-07-23, 8:56 am

On Friday 23 July 2004 11:53, Bastian Angerstein wrote:
> Hello,


Hi Bastian,

>
> is it possible to execute code that is within a var?
>
> like:
>
> $var = 'print "Hallo Welt\n"';
>
> I had seen something like that in compination with eval...


something like this?

my $var = 'print "Hallo Welt\n";';
eval($var) or die "could not execute : $@";

HTH,

Philipp
Sponsored Links







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

Copyright 2008 codecomments.com