In article <. com>,
bing <> wrote:
: $name0 = 0;
: $name1 = 1;
: $name2 = 2;
:
: %map = (
: name0 => 'zero',
: name1 => 'one',
: name2 => 'two'
: );
:
: for ($j=0;$j<=2;$j++)
: {
: print "$map{name{$j}}, $name{$j}\n";
: }
Change what you're printing, e.g.,
print qq[$map{"name$j"}, name$j\n];
If you're trying to grab the values of $name[0-2], read mjd's series
on why using a variable as a variable name is a bad idea.
http://perl.plover.com/varvarname.html
http://perl.plover.com/varvarname2.html
http://perl.plover.com/varvarname3.html
Consider, for example, grabbing the name from reverse(%map).
Hope this helps,
Greg
--
Isn't it curious how "page" has become a colloquial term for the word
"document" in hypertext, in a medium that does not have pages anymore?
Do we reuse words as soon as they are freed up by technology? Do we reuse
those of whose destruction we can't bear to be reminded? -- Jutta Degener