rzward has asked for the wisdom of the Perl Monks concerning the following question:
I have a question about the following code, which is in a Perl CGI script that runs on web servers:
sub anySub
{
:
local (@recArray) ;
while (defined ($_ = <$fileHandle>))
{
push (@recArray, $_) ;
}
:
}
Is it possible for recArray to start off not empty? If so, what's the best way to make sure recArray starts off empty? How about local (@recArray) = ();?
This is an older script, so maybe using my instead of local would be better also, as in my (@recArray) = ();?
Thank you in advance for your help.
Richard
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Proper way to initialize local variables
by tlm (Prior) on May 11, 2005 at 22:03 UTC | |
by rzward (Monk) on May 11, 2005 at 22:45 UTC | |
by Tanktalus (Canon) on May 11, 2005 at 23:17 UTC | |
|
Re: Proper way to initialize local variables
by borisz (Canon) on May 11, 2005 at 22:09 UTC | |
|
Re: Proper way to initialize local variables
by Zaxo (Archbishop) on May 12, 2005 at 21:34 UTC |