With the intention of optimization, I am looking for a way around using
*eval* in the below snippet at line 19:
my $value = eval $key;
The objective is to get from $key to $value, knowing that $key is a
literal string.
Thank you for an insights!
#!/usr/bin/perl -w
use strict;
use Data::Dumper qw(Dumper);
my $hash = {
'food' => {
'fruit' => [
{
'name' => 'apple',
'color' => 'red',
},
],
},
};
my $key = '$$hash{\'food\'}{\'fruit\'}[0]';
my $value = eval $key;
print Dumper( $value );
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>