in reply to Real World 1, Great Expectations 0
Your problem is caused by an odd ambiguity of the "indirect object" syntax that print uses. That is, when you say:
would it meansomething $array[$i]
orsomething {$array} [$i]
(where the {} can be used to set off the actual "object" you want to act on)? To resolve this ambiguity without incuring too much lookahead, perl treats it like:something {$array[$i]}
You do have arguments after it, so concievably perl could disambiguite:something {$array} [$i]
into:something $array[$i] $something_else
but it doesn't try to look that far ahead, it just treats it like:something {$array[$i]} $something_else
which is a syntax error because it has no comma (update: after the [$i])something {$array} [$i] $something_else
Thus, there are two ways to make that take $handles[$i] be the first argument:
update: see also perlobj which discusses this ambiguity under the heading "WARNING".
(update: minor grammatical edit(s) above)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Real World 1, Great Expectations 0
by hsmyers (Canon) on Oct 18, 2001 at 04:41 UTC | |
by greywolf (Priest) on Oct 18, 2001 at 20:10 UTC | |
by pjf (Curate) on Oct 19, 2001 at 03:39 UTC |