Jerry Preston wrote:
Hi!

This one is new to me and I need to be able to read $name and $age from the
following:

@history = (
{
program => 'new',
version => '0.42',
},
input => {
'/data' => 0.14,
'/home' => undef,
},
input_contents => '
$name = \'Jerry\'; $age = \'25\'; 1;
'
} #I think there is a typo



you meant ) right



This is a very strange way of having data. If there is an option please change the structure of the data array


Assuming you always have data in the same format
do this

unshift @history , "dummy";

my %hash = @history;
{
my $name;
my $age;

eval($hash{input_contents}) || warn $@;
          # A stupid way but I can see a better one

print "AGE = $age\n";

}

Ram


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to