The other 2 ways you showed of doing this code do not work. I have to have
the "@key =" in to run the code.

-----Original Message-----
From: Aaron Craig [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 08, 2001 1:19 PM
To: [EMAIL PROTECTED]
Subject: RE: the ENV command? parameter?


At 11:15 08.06.2001 -0400, you wrote:
>I am totally lost on this one. What is the difference?
> >
> >foreach(@key = keys(%ENV))
> >{
> >         print "$_: $ENV{$_}<br>\n";
> >}
>except you should write
>
>foreach(keys %ENV)
>          {
>          print ...
>          }

The @key = keys(%ENV)) is extraneous -- keys %ENV already gives you a list, 
and since you're only interested in it for the scope of the foreach 
statement (at least in this example) there's no need to set the list to a 
variable -- besides which, your @key array would die outside of the foreach 
loop anyway -- if you're using strict, which you should be :)

Aaron Craig
Programming
iSoftitler.com

Reply via email to