Ing. Branislav Gerzo wrote:
JupiterHost.Net [JN], on Thursday, April 28, 2005 at 09:11 (-0500)
contributed this to our collective wisdom:

(really beginners) could think "@a" will empty array, which is not
true.

JN> yes it is true, they are both empty lists:

@a will not empty array, here it is:

my @a = q{foo bar};
@a;
print @a;

against

my @a = q{foo bar};
@a = ( );
print @a;

I hope you see the difference :)

And you would as well if you had warnings enabled as the first example would warn you about using an array in void context.

$ perl -le'
use warnings;
my @a = qw{foo bar};
@a;
print @a;
'
Useless use of private array in void context at -e line 3.
foobar



John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to