develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000330.052] Use of uninitialized value in concatenation (.)

From:
Tom Christiansen
Date:
March 30, 2000 20:25
Subject:
Re: [ID 20000330.052] Use of uninitialized value in concatenation (.)
Message ID:
20793.954476734@chthon
I don't think you want to start down this path.  We have a compiler.
It does things for you.  You have to learn this.

    % perl -e 'if(0) { 1; FRED: 2; 3 } goto FRED'
    Can't find label FRED at -e line 1.

Huh, what do you mean you can't find the label?  It's right there!
What a stupid compiler.

    % perl -MO=Deparse -e 'if(0) { 1; FRED: 2; 3 } goto FRED'             
    '???';
    goto FRED;

or this one:

    % perl -MO=Deparse -e 'if (1) { print "now" } else { print "then" }'
    print 'now';;
    -e syntax OK

or this one:

    % perl -ce 'if (eval { sqrt(-10); 1 } ) { print "ok" } '
    Can't take sqrt of -10 at -e line 1.

or this:

    % perl -e 'sub neg10() { -10 } if (eval { sqrt neg10(); 1 } ) { print "ok" } '
    Can't take sqrt of -10 at -e line 1.

Lok at that, it's compile-only, and it still copmlains.  I never
told the compiler to take the sqrt of -10.  I said to take it of neg10().
Er, didn't I?

Again, are you *REALLY* sure you want to go down this road and
unravel all the things the compiler and do and then say which will
confuse the ignorant?   Isn't it better to cure ignorance -- or,
failing that, simply ignore them?

--tom



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About