Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Using the Variable Name from an Array

by shmem (Chancellor)
on Nov 14, 2019 at 17:13 UTC ( #11108683=note: print w/replies, xml ) Need Help??


in reply to Re^2: Using the Variable Name from an Array
in thread Using the Variable Name from an Array

Getting @ the variable_name inside of the array is what I can not remember how to do.

You don't have a variable_name inside of the array available by assignment. You have the values of the variables.

If you want to access the values by name, do so using a hash:

$test =12; $test2 =13; %hash=( test => $test, test2 => $test2, ); foreach $name(qw(test test2)) { print "$name $hash{$name}\n"; }
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11108683]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2020-06-02 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (16 votes). Check out past polls.

    Notices?