On 7/21/07, Jack Minoshima <[EMAIL PROTECTED]> wrote:
snip
I know no use strict 'subs' allows bare word,
but I didn't know Perl would automatically quotes bareword ;)
snip
That is a simplification. The following code contains nothing but barewords:
perl -le 'print STDOUT STDOUT'
Only the second STDOUT is stringified even though they are all
barewords. Perl only stringifies barewords that are used in a context
it doesn't understand. Look at this
perl -le 'sub hw { "hello world" };print STDOUT hw'
perl -le 'print STDOUT hw; sub hw { "hello world" }'
The first prints "hello world", but the second prints "hw". This is
because, in the first case, perl has already seen a definition of hw
before encountering its bareword use*, so it understands that hw is a
subroutine. This is one of the reasons the strict pragma is so
important.
* well, second bareword use, but perl understands that a bareword
after "sub" is subroutine name.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/