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

Re: Interpolate variable name in Perl?

by Eily (Curate)
on Oct 24, 2013 at 16:07 UTC ( #1059509=note: print w/ replies, xml ) Need Help??


in reply to Interpolate variable name in Perl?

Yes you could do that with symbolic references, but you could actually just use an array @char, so that your characters would be stored in $char[0], $char[1], $char[2]. Besides, there's a simpler way to divide a string into chars : @char = split //, $string;

And if you want to have "automatic variable name" instead of "automatic variable number", you should use a hash instead of the array. Have a look at perldsc for more information on the subject.


Comment on Re: Interpolate variable name in Perl?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2015-07-06 21:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (83 votes), past polls