in reply to possible to evaluate scalars stored in a string?
Something like: (code tested)
use strict; use warnings; my $var1 ="a.pl"; my %hash = ( "command1" => "type $var1" ); system ($hash{"command1"});
Update:
I was thinking of adding this update, and at the same time, I saw the reply from emilford. I like this better:
use strict; use warnings; my %hash = ( "command1" => "type %s" ); my $var1 ="a.pl"; system(sprintf($hash{"command1"}, $var1));
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: possible to evaluate scalars stored in a string?
by emilford (Friar) on Dec 13, 2003 at 03:30 UTC |