[Israel.pm] scalars and arrays

Eitan Schuler Eitan.schuler at exlibris.co.il
Sun Feb 15 04:32:41 PST 2004


@ always refers to a list
$ always refers to  a scalar.
@array is a list, but a specific value of the list is a scalar.
The type of the first sign is determined by the type of the whole
expression.
That's why $array[1] is correct and @array[1] is not correct.

I think the strange thing is that your first example compiles.

Eitan

-----Original Message-----
From: Yossi.Itzkovich at ecitele.com [mailto:Yossi.Itzkovich at ecitele.com]
Sent: Sunday, February 15, 2004 2:04 PM
To: Perl in Israel
Subject: [Israel.pm] scalars and arrays



Hi,

I know that:

@array[$y]=8;

should be written as:

$array[$y]=8;

But  what is really happens when I write it as in the first example ?  Why
@array isn't modified ?

Yossi


_______________________________________________
Perl mailing list
Perl at perl.org.il
http://www.perl.org.il/mailman/listinfo/perl

YAPC::Israel::2004
http://www.perl.org.il/YAPC/2004/



More information about the Perl mailing list