Chas. Owens wrote:
>
On Jan 22, 2008 8:45 PM, bootleg86 bootleg86 <[EMAIL PROTECTED]> wrote:

I came across this construct
foreach $i ( @{$y} ) {
  #do something
}

Is @ referring to some default array that doesn't need to be declared?

Also it's using the associative version of an array?
I always thought only hashes were associative.
snip

If the code works (and it isn't guarenteed to)

I'm not sure what you mean here. It's as guaranteed to work as any other
Perl code snippet I've seen.

then $y holds a reference to an array and @{} is being used to
corerce it into behaving like an array (i.e. dereferencing it).

It's not coercing $y to do anything. It's accessing the array to which
$y refers.

Rob

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


Reply via email to