in reply to another 'array to hash' question
if I have a variable $name, how do I get the string after the $, that is, 'name' in this case?
That's a silly question. Suppose there was a magical function that just did that. Suppose the magical function is called mushroom. Then you would have:
There would be no gain. You could as well have typed:my $name_of_var = mushroom $name; print $name_of_var; # prints 'name'.
after all, if you know which variable to get the name of, you already have the name. It's like phoning someone to ask his/her phone number.my $name_of_var = 'name';
Furthermore, what if the variable is $foo {bar} () -> [3], what should this magical function return?
Abigail
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: another 'array to hash' question
by punkish (Priest) on Dec 10, 2003 at 15:02 UTC | |
by Abigail-II (Bishop) on Dec 10, 2003 at 15:45 UTC | |
by punkish (Priest) on Dec 10, 2003 at 16:04 UTC | |
by Abigail-II (Bishop) on Dec 10, 2003 at 16:26 UTC |