Glad it helped - I'm never sure when I can't test for myself. BTW, how about:
eval $code; $error .= " $@" if $@; Cheers, Rob ----- Original Message ----- From: "Dan Muey" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 18, 2002 3:02 PM Subject: RE: Executing a variable that contains perl code > Thanks! Eval was it. I knew there was something but I never use eval. Thanks for the kick in the pants! > What I'm going to end up using is this : > > eval $code;if($@) { $error = "$error $@"; } > > Dan > > -----Original Message----- > From: Rob Dixon [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, December 18, 2002 5:42 AM > To: Dan Muey; [EMAIL PROTECTED] > Subject: Re: Executing a variable that contains perl code > > > Dan > > I'm not a Unixite, but something like > > eval $ENV{$code_here}; > > will do the trick. > > Rob > > > > ----- Original Message ----- > From: "Dan Muey" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, December 17, 2002 10:24 PM > Subject: Executing a variable that contains perl code > > > > Anybody know of any modules or ways to execute a variable that > > contains > perl code as if it were part of the script? > > > > IE do : print `/usr/bin/perl -e '$code_here'`; > > > > Except be able to use variables/arrays/hashes/routines that are in the > script with that line > > > > EG : print `/usr/bin/perl -e '$code_here'`; > > Works great if $code_here is just a print statement or uses it's own > vars/routines, etc > > But I need to be able to have some code like this : > > > > $joemama = "HI"; > > sub joe { print "Mama"; } > > > > $code_here = 'print $joemama\;&joe\;'; # actually this var gets set > > with > perl code in a mysql database > > > > print `/usr/bin/perl -e '$code_here'`; > > > > output this : > > HIMama > > > > How can I get it to be able to use the script's vars and routines etc? > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]