Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Perl has a large number of built-in functions; they are described on the perlfunc manpage [Wall 2011]. Perl also has a handful of reserved keywords such as while; they are described on the perlsyn manpage [Wall 2011].

Do not use an identifier for a subroutine that has been reserved for a built-in function or keywordWhen a package variable is declared local, it is often assumed that the package variable's contents are duplicated and stored in the local variable. This is not so; the local variable is set to undef, just like any other uninitialized variable. Consequently, local variables must be initialized. They may be initialized with the contents of the package variable. If they are meant to be uninitialized, they should be explicitly set to undef.

Noncompliant Code Example

...

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

DCL04-PL

lowLow

probableProbable

mediumMedium

P2P4

L3

Automated Detection

...

  
ToolDiagnostic
Perl::CriticVariables::RequireInitializationForLocalVars 

Bibliography

  

...

...

...

 

 
 
 

...

Image Removed      01. Declarations and Initialization      DCL32-PL. Every module must return a true valueImage Added Image Added Image Added