* Mandar Rahurkar <[EMAIL PROTECTED]> [2004-08-16T17:32:28]
> Hi,
> I have a list ,
> $list=['orange','red','purple'];
>
> How do I access each member of $list ? If this had been @list I cud have
> done,
>
> foreach(@list) {
> print $_;
> }
>
> How does it work for a scalar ?
You really, really need to read the "perlreftut" page, which you can see
by running "perldoc perlreftut" at your command prompt.
$arrayref = [ 1, 2, 3 ]; creates a reference to an array. To get at its
members you can do this:
foreach (@$arrayref) { print }
or just:
print $arrayref->[0];
Please read that document. It will help you understand what's going on.
--
rjbs
pgpAs9pWq66Jx.pgp
Description: PGP signature
