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

Re: [ID 20000324.056] -x still don't work as advertised in perlfunc

Thread Previous
From:
Tom Christiansen
Date:
March 24, 2000 15:02
Subject:
Re: [ID 20000324.056] -x still don't work as advertised in perlfunc
Message ID:
17650.953938929@chthon
Known issue.  In fact, this is a regression bug.

    % perl4.036 -wle 'print -s STDIN / 2' < /etc/termcap
    67908

    % perl -wle 'print -s STDIN / 2' < /etc/termcap
    Argument "STDIN" isn't numeric in division (/) at -e line 1.
    Use of uninitialized value in print at -e line 1.

As you yes, it *used* to work fine.

Here are more test cases.

    % perl -wle 'print -s(STDIN)/2' < /etc/termcap
    Argument "STDIN" isn't numeric in division (/) at -e line 1.
    Use of uninitialized value in print at -e line 1.

    % perl -wle 'print -s(*STDIN)/2' < /etc/termcap
    Argument "*main::STDIN" isn't numeric in division (/) at -e line 1.
    Use of uninitialized value in print at -e line 1.

    % perl -wle 'print ((-s(STDIN))/2)' < /etc/termcap
    print (...) interpreted as function at -e line 1.
    217449

    % perl -wle 'print ((-s(STDIN))/2);' < /etc/termcap
    217449

    % perl -wle 'print 0.5 * -s(STDIN)' < /etc/termcap
    217449

    % perl -wle 'print 0.5 * -s(STDIN)' < /etc/termcap
    217449

    % perl -wle 'print 0.5 * -s(STDIN) * 2' < /etc/termcap
    Argument "STDIN" isn't numeric in multiplication (*) at -e line 1.
    Use of uninitialized value in multiplication (*) at -e line 1.
    0

This is just another example of the same precedence bug as
we eventually fixed with not().

    % perl5.005_54 -wle 'print not(0) * 4'
    1
    % perl5.5.670  -wle 'print not(0) * 4'
    4

Which reminds me...

    % perl -MMath::Complex -wle 'print 4 * -i' ;
    Unrecognized file test: -i at -e line 1.
    Exit 255

    % perl -MMath::Complex -wle 'print 4 * -i()' ;
    Unrecognized file test: -i at -e line 1.
    Exit 255

    % perl -MMath::Complex -wle 'print 4 * -(i)' ;
    -4i

--tom

Thread Previous


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