Re: strict irony

From: Jay Tilton (tiltonj_at_erols.com)
Date: 04/11/04


Date: Sun, 11 Apr 2004 15:51:26 GMT

J Krugman <jkrugman@yahbitoo.com> wrote:

: use strict;
:
: print "Ain't it ironic?\n" if strict;
: print "The things you learn...\n" if BAREWORD;
: print "What's going on here?\n" if bewildered;
:
: # but if this line is uncommented, script won't compile:
: # my $x = BAREWORD;

The 'if' modifiers are being optimized away. Why the optimizing phase
would turn a blind eye to barewords under strict subs, I don't know.

Compounding the mystery, adding "use warnings;" causes the missing
"Bareword not allowed" compilation errors to surface. Changing 'if' to
'unless' causes compilation errors as well.

A most curious discovery.



Relevant Pages

  • Re: confused about a regex
    ... absence of that stricture, a bareword is treated ... interpreter hasn't seen a definition for abc, eeeee, or i yet). ... The short answer is they don't if you use the strict pragma like you ... sub abc {"abc." ...
    (perl.beginners)
  • Re: code review - JSON parsing and data structures
    ... Didn't that give some bareword diagnostic under use strict, ... a function or a string. ... perl can go to really strange places: ...
    (comp.lang.perl.misc)
  • Re: Look At This Package
    ... Bareword "fname" not allowed while "strict subs" in use at utest line 12. ... my $ui = new UserInfo(); ... sub full_name ...
    (perl.beginners)
  • Bareword errors?
    ... getting an inconsistant bareword error ... strict accepts the first use of the bareword(?) but not later - ... (not under strict one runs - the other gives error. ... read(STDIN, $buffer, $ENV); ...
    (comp.lang.perl.misc)