Hello All,

I have a reference to hash structure, and a path where data is found.
Is it possible to retrieve the data where path is found ?


# What I am looking for:
my $hash = {
        'key1' => { 'key11' => 10 },
        'key2' => { 'key21' => { 'key22' => { 'key23' => 100 }}},
        'key3' => { 'key31' => { 'key321' => 20,
                                                         'key322' => 200 }}
};

# this will not work since it's not referencing to nothing
my $path = {'key3'}->{'key31'}->{'key321'};

# doesn't work for me :-(
print $hash->{$path};

# work (but i wanna use $path as location reference)
print $hash->{'key3'}->{'key31'}->{'key321'};

-- 
===================
----     Chanan Berler    ----
===================
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to