in reply to Invalid sub ignored on use strict;

I've just run the following tests:
H:\>perl -Mstrict -w (1==1) or dir "hello"; String found where operator expected at - line 1, near "dir "hello"" (Do you need to predeclare dir?) ^Z syntax error at - line 1, near "dir "hello"" Execution of - aborted due to compilation errors.
or:
H:\>perl -Mstrict -w (1==0) or dir "hello"; String found where operator expected at - line 1, near "dir "hello"" (Do you need to predeclare dir?) ^Z syntax error at - line 1, near "dir "hello"" Execution of - aborted due to compilation errors.

Is it possible that this code you posted comes from a module or the like where strict is not loaded?

(Btw: I tried it with Win2k and ActivestatePerl 631)

Best regards,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

Replies are listed 'Best First'.
Re: Re: Invalid sub ignored on use strict;
by derby (Abbot) on Apr 30, 2002 at 11:46 UTC
    true. but look at the snippet again and try your code:

    $ perl -Mstrict -w (1==1) or dir( "hello" ); $ perl -Mstrict -w (1==0) or dir("hello"); Undefined subroutine &main::dir called at - line 1.

    Luck's played a big part here and the conditional statement has never been exercised (unless of course dir is defined somewhere). The parens counter the 'use strict' which checks for the use of barewords as subs.

    -derby

A reply falls below the community's threshold of quality. You may see it by logging in.