Ing. Branislav Gerzo wrote:
JupiterHost.Net [JN], on Wednesday, April 27, 2005 at 08:15 (-0500) thoughtfully wrote the following:
5> my @fa =(); 6> my @ha =();
JN> my @fa; JN> my @ha; JN> the = () isn't necessary and doesn't keep you from getting uninitialized JN> value warnings like you think it does, thats only scalars.
I always use for declaring arrays and hashes @foo = (); too. I think this is proper how to do that. Also it is similar as someone use
No its not, you can if you want but it pointless:
# perl -mstrict -we 'my $u;my @x;print @x;' # perl -mstrict -we 'my $u;my @x;print $u;' Use of uninitialized value in print at -e line 1. #
It was news to me to, there was thread recently with details if you really want the details.
> $|++;, and I use $| = 1;
That two ways to assign 1 to $|, its not similar to the array thing at all.
If you think
@ar = (); is better that @ar; then why not go step further:
my @ar = (); @ar = () unless @ar; my $cnt = 0; for(@ar) { $cnt++; } die "Array not empty" if @cnt;
why? because its pointless :)
just do
my @ar;
and you're assured an empty list.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>