Hello all,

Please see the sequence below:

----------------------\/--------BEGIN---------\/----------------------
1 % perl -v | grep built
This is perl, v5.6.0 built for i686-linux
2 %
2 % perl -wMstrict -le 'print bogus'
Unquoted string "bogus" may clash with future reserved word at -e line 1.
Name "main::bogus" used only once: possible typo at -e line 1.
Filehandle main::bogus never opened at -e line 1.
3 %
3 % perl -wMstrict -le 'print + bogus'
Name "main::bogus" used only once: possible typo at -e line 1.
Filehandle main::bogus never opened at -e line 1.
4 %
4 % perl -wMstrict -le 'print 0 + bogus'
Bareword "bogus" not allowed while "strict subs" in use at -e line 1.
Execution of -e aborted due to compilation errors.
5 %
5 % perl -wMstrict -le 'print - bogus'
-bogus
6 %
6 % perl -wMstrict -le 'print 0 - bogus'
Bareword "bogus" not allowed while "strict subs" in use at -e line 1.
Execution of -e aborted due to compilation errors.
7 %
7 % perl -wMstrict -MData::Dumper -le 'print Dumper(- bogus)'
$VAR1 = '-bogus';
8 %
8 % perl -wMstrict -MData::Dumper -le 'print Dumper(+ bogus)'
Bareword "bogus" not allowed while "strict subs" in use at -e line 2.
Execution of -e aborted due to compilation errors.
9 %
9 % echo $SHELL $version
/usr/local/bin/tcsh tcsh 6.10.00 (Astron) 2000-11-19 (i386-intel-linux) \
        options 8b,nls,dl,al,kan,rh,color,dspm
        # I line-wrapped the output here, to fit in 80 columns.
10 %
----------------------/\---------END----------/\----------------------

Why does perl behave differently for the various commands above?

I have some specific questions about some of the commands.

Command 2:
With "-Mstrict", why does perl not flag a bareword error?

Command 3:
"perldoc perlop" says:

> Unary "+" has no effect whatsoever, even on strings.

But clearly, in Command 3, it suppresses the "Unquoted
string" error message, while it continues to interpret
"bogus" as a filehandle.  Why is this?

Command 5:
Why is "- bogus" not treated as a unary minus operation on a
bareword?  Why does it get stringified and squeezed into
"-bogus"?  (See Command 7.)

TIA.

peace,               || Udayachal: a newspaper edited by slum children:
--{kr.pA}            || http://tinyurl.com/57jaf
-- 
This .sig intentionally left blank.
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to