Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Off by one key... or yet another example of why strict and warnings are always a good idea (even for "one-liners")

by LanX (Archbishop)
on Jul 18, 2019 at 00:53 UTC ( #11102961=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    C:\>set PERL5OPT=-w -Mstrict
    
    ...
    Global symbol "$x" requires explicit package name (did you forget to d
    +eclare "my $x"?) at -e line 1.
    Execution of -e aborted due to compilation errors.
    
  2. or download this
    C:\>set PERL5OPT=-w -Mstrict=refs,subs
    
    C:\>perl -e"print $x"
    Name "main::x" used only once: possible typo at -e line 1.
    Use of uninitialized value $x in print at -e line 1.
    
  3. or download this
    C:\>perl -le "my $str = q{zxcv}; if ( $str -~ m/some pattern/i ) { pri
    +nt $str; }"
    Use of uninitialized value $_ in pattern match (m//) at -e line 1.
    Argument "zxcv" isn't numeric in subtraction (-) at -e line 1.
    zxcv
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11102961]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2019-12-05 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (151 votes). Check out past polls.

    Notices?