in reply to Re: Re: Re: possible to evaluate scalars stored in a string?
in thread possible to evaluate scalars stored in a string?

Well, it's perfectly possible and reasonable to do it with eval:
%hash = ( 'command' => '"command_name -n $var1 -p $var2"' ); $var1 = 'foo'; $var2 = 'bar'; $command = eval $hash{'command'}; print $command;
Just changed it so that what's being eval'd is a valid perl expression that evaluates to what he wants.

------------
:Wq
Not an editor command: Wq

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: possible to evaluate scalars stored in a string?
by tachyon (Chancellor) on Dec 13, 2003 at 05:07 UTC

    ++ I remebered there was a double quoting way to do it but could not remeber exactly what and make it work.....

    cheers

    tachyon