On Thu, 31 Mar 2005 13:43:14 -0800, John W. Krahn wrote:
> > Ah, but there is an important difference - in all the cases I wrote,
> > the characters following the '@' sign could not be a legal variable
> > name,
>
> $ perl -le' @) = qw/ a b c d /; print for @) '
Educational thread, this :-)
>
> perldoc perlop
> [snip]
> Quote and Quote-like Operators
> [snip]
> Interpolating an array or slice interpolates the elements in order,
> separated by the value of $", so is equivalent to interpolating "join
> $",
> @array". "Punctuation" arrays such as "@+" are only interpolated if
> the name is enclosed in braces "@{+}".
>
Ah, *now* I see why both my code and yours work - in my case, the
"variables" were not interpolated according to the rule you just
quoted. In your code:
$ perl -le' @) = qw/ a b c d /; print for @) '
There is no interpolation going on, so '@)' is treated as a variable name.
Quick reality check for myself:
$ perl -le' @a = qw/ a b c d /; print for "@a"'
a b c d
$ perl -le' @) = qw/ a b c d /; print for "@)"'
@)
Now all is well :-)
But now I'm confused - if you knew of the above rule, why take me to
task for not escaping the '@' sign in my code?
Regards,
--
Offer Kaye
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>