AndrewMcHorney wrote:
Hello
Hello,
I put the strict and warning statements in my perl code. I now need to
initialize arrays. What is the best way to initialize an array before
the loop where I will basically recreating the array size in the loop?
my @array = ?
while (more work to do)
{
@array = split $string;
# do work on array
}
It is usually best to declare variables in the smallest scope possible so:
while (more work to do)
{
my @array = split $string;
# do work on array
}
John
--
Those people who think they know everything are a great
annoyance to those of us who do. -- Isaac Asimov
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/