Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: best way to learn use strict

by cjcollier (Novice)
on Jul 15, 2003 at 20:47 UTC ( [id://274573]=note: print w/replies, xml ) Need Help??


in reply to best way to learn use strict

Running all of your scripts with the -w flag will help you remove any problems. Probably the best way to learn to use strict and remove warnings is to put
#!/usr/bin/perl -w use strict;
at the top of your script and rectify any of the warnings that perl prints.

Cheers,

C.J.

Replies are listed 'Best First'.
Re: Re: best way to learn use strict
by Anonymous Monk on Jul 16, 2003 at 11:47 UTC
    I have two problems with this: #!/usr/bin/perl -w use strict; The -w, causes double print on stdout, this breaks my CGI scripts, on solaris. use strict, doesn't catch undefined variables in subroutines, that has the same name as variables outside, that has been declared, this causes hard to find bugs.
      use strict, doesn't catch undefined variables in subroutines, that has the same name as variables outside, that has been declared, this causes hard to find bugs.

      You don't want this. It is the entire point of strictures to be able to safely use a variable name without knowing whether it has been used before and not make code break.

      If you want the opposite, then you're using quasi-globals. Instead, define variables in the smallest possible scope, so that they're not visible from anywhere other than where they get used.

      Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-25 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found