in reply to Re^4: perl eval
in thread perl eval
and I just want to evaluate whatever is there in the parameter
That might end in tears!
use strict; use warnings; my $param = shift; eval $param; die $@ if $@;
Let's see some files.
$ perl spw848064 'system ls' reallyImportant.data spw848064 $
You can see what's coming :-)
$ perl spw848064 'system qw{rm -f reallyImportant.data}' $
Oops!
<!--$ perl spw848064 'system ls' spw848064 $
It might be worth doing a little sanity checking before evaling willy-nilly.
Cheers,
JohnGG
|
|---|