esharris has asked for the wisdom of the Perl Monks concerning the following question:

Why does the execution of the following program output "TRUE"? I expected an error indicating that TRUE was undefined.
#!/usr/local/bin/perl -w use strict; print TRUE."\n";

edited: Thu May 29 20:51:55 2003 by jeffa - code tags

Replies are listed 'Best First'.
Re: Strange name
by broquaint (Abbot) on May 29, 2003 at 16:58 UTC
    Since all barewords in perl are essentially strings, and you're forcing stringification with the concatenation, this behaviour is to be expected e.g
    shell> perl -MO=Deparse -Mstrict -Mwarnings -e 'print TRUE."\n";' print 'TRUE' . "\n"; -e syntax OK

    HTH

    _________
    broquaint

Re: Strange name
by boo_radley (Parson) on May 29, 2003 at 17:11 UTC
    perl (and strict) doesn't recognize TRUE as a variable (it has no sigil), but as a literal, which perl recognizes as plain text.