in reply to Re: Symbolic references
in thread Symbolic references

You've partially lost me with that answer.

What if I may have a variable number of variables..
program.pl var1 program.pl var1/var2 program.pl var1/var2/var3
etc? Is there a programatic way to read N variables into the reference?

Replies are listed 'Best First'.
Re^3: Symbolic references
by LanX (Saint) on Apr 15, 2013 at 05:53 UTC
    I've changed my code to be less terse and hopefully better understandable step by step.

    > What if I may have a variable number of variables..

    you can put a unlimited anount of elements into '$path' and it will work as long as the intermediate values really exist within the nested hashes (otherwise the result is undef).

    > Is there a programatic way to read N variables into the reference?

    ??? what do you mean here with "reference"?

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      I used the wrong word 'reference' it should have been variable. I've tried to impliment your code below, but I'm still lost...
      foreach $argnum (0..$#ARGV){ print "$ARGV[$argnum]\n"; my $path=$ARGV[$argnum]; @path=split /\//,$path; $node=node->{$_} for @path; print $node; } print "\n"; }
        got it! phew!
        foreach $argnum (0..$#ARGV){ $node=$ret; print "$ARGV[$argnum]\n"; @path=split /\//,$ARGV[$argnum]; print Dumper @path; #debugging helps! $node=$node->{$_} for @path; print $node; } print "\n"; }
        Thanks!