help! 
Author Message
 help!

I'm having a problem getting things like %{$var} and ${$var}{$stuff}
to work (I'm not sure what you would call that).  When I run the
following:

$a = "x.c";

%{$a} = (a, apple, b, banana, c, cherry);

print ${$a} . "\n";
print ${$a}[2] . "\n";
print ${$a}{"a"} . "\n";
$dnt = $a;
print ${$dnt}{"b"} . "\n";
$dnt = "x.c";
print ${$dnt}{"c"} . "\n";

I expect to see:

1
hello
threeeee
apple
banana
cherry

but I get two blank lines instead of banana and cherry.  Am I doing
something wrong or silly, or is this a bug?  (Maybe both. :-)

                                                chris

--
Interface copyrights and software patents will devastate the software



Sun, 19 Feb 1995 09:45:10 GMT  
 help!

What you want is:


%a = (a, apple, b, banana, c, cherry);

then things like:

print $a, $a{'a'}, $a[0], "\n";

Will work.

${$a} is not valid in perl (or at least, it does something that you
are not expecting).

                        -AJS

--
--------
Disclaimer: I am solely responsible for the content of this message.
The views expressed here may not be the views of I-Kinetics, Fidelity,
any of the Fidelity-owned corporations or my mother.



Mon, 20 Feb 1995 00:23:19 GMT  
 help!
: ${$a} is not valid in perl (or at least, it does something that you
: are not expecting).

Though, oddly enough, his example probably WILL work in Perl 5.  I take
that as confirmation I'm headed the right direction...

Larry



Tue, 21 Feb 1995 02:30:31 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HELP HELP HELP HELP HELP

2. ****** HELP HELP HELP ******

3. help .. help help

4. Help Help Help!!!!

5. Help Help Help!!!

6. Help...Help, install failed, please help!!

7. Help Help Please Help !

8. help help help please!!!!

9. HELP HELP HELP!!! - with function call parameters

10. please, help me, help me, help me.....

11. Announcing: The Perl Institute: Helping people help Perl help people

12. Help Help Help!!!

 

 
Powered by phpBB® Forum Software