U
usenet
Kindly consider this simple script:
#!/usr/bin/perl -w
@x = qw/foo bar baz/;
print qq{$x[1]\n}
__END__
Which prints "bar\n" (as expected).
AFAIK, this should be the same thing as doing it this way:
perl -we "@x = qw/foo bar baz/; print qq{$x[1]\n}"
but the second case doesn't see $x[1] as a value of an array (it sees
$x as an independent - and undef - scalar and '[1]' as a string literal
- which, of course, generates a warning that "main::x" is used only
once...)
What am I missing here???
Thanks!
#!/usr/bin/perl -w
@x = qw/foo bar baz/;
print qq{$x[1]\n}
__END__
Which prints "bar\n" (as expected).
AFAIK, this should be the same thing as doing it this way:
perl -we "@x = qw/foo bar baz/; print qq{$x[1]\n}"
but the second case doesn't see $x[1] as a value of an array (it sees
$x as an independent - and undef - scalar and '[1]' as a string literal
- which, of course, generates a warning that "main::x" is used only
once...)
What am I missing here???
Thanks!