You are viewing the version of this documentation from Perl 5.12.5. View the latest version

CONTENTS

NAME

perltrap - Perl traps for the unwary

DESCRIPTION

The biggest trap of all is forgetting to use warnings or use the -w switch; see perllexwarn and perlrun. The second biggest trap is not making your entire program runnable under use strict. The third biggest trap is not reading the list of changes in this version of Perl; see perldelta.

Awk Traps

Accustomed awk users should take special note of the following:

C/C++ Traps

Cerebral C and C++ programmers should take note of the following:

Sed Traps

Seasoned sed programmers should take note of the following:

Shell Traps

Sharp shell programmers should take note of the following:

Perl Traps

Practicing Perl Programmers should take note of the following:

Perl4 to Perl5 Traps

Practicing Perl4 Programmers should take note of the following Perl4-to-Perl5 specific traps.

They're crudely ordered according to the following list:

Discontinuance, Deprecation, and BugFix traps

Anything that's been fixed as a perl4 bug, removed as a perl4 feature or deprecated as a perl4 feature with the intent to encourage usage of some other perl5 feature.

Parsing Traps

Traps that appear to stem from the new parser.

Numerical Traps

Traps having to do with numerical or mathematical operators.

General data type traps

Traps involving perl standard data types.

Context Traps - scalar, list contexts

Traps related to context within lists, scalar statements/declarations.

Precedence Traps

Traps related to the precedence of parsing, evaluation, and execution of code.

General Regular Expression Traps using s///, etc.

Traps related to the use of pattern matching.

Subroutine, Signal, Sorting Traps

Traps related to the use of signals and signal handlers, general subroutines, and sorting, along with sorting subroutines.

OS Traps

OS-specific traps.

DBM Traps

Traps specific to the use of dbmopen(), and specific dbm implementations.

Unclassified Traps

Everything else.

If you find an example of a conversion trap that is not listed here, please submit it to <perlbug@perl.org> for inclusion. Also note that at least some of these can be caught with the use warnings pragma or the -w switch.

Discontinuance, Deprecation, and BugFix traps

Anything that has been discontinued, deprecated, or fixed as a bug from perl4.

Parsing Traps

Perl4-to-Perl5 traps from having to do with parsing.

Numerical Traps

Perl4-to-Perl5 traps having to do with numerical operators, operands, or output from same.

General data type traps

Perl4-to-Perl5 traps involving most data-types, and their usage within certain expressions and/or context.

Context Traps - scalar, list contexts

Precedence Traps

Perl4-to-Perl5 traps involving precedence order.

Perl 4 has almost the same precedence rules as Perl 5 for the operators that they both have. Perl 4 however, seems to have had some inconsistencies that made the behavior differ from what was documented.

General Regular Expression Traps using s///, etc.

All types of RE traps.

Subroutine, Signal, Sorting Traps

The general group of Perl4-to-Perl5 traps having to do with Signals, Sorting, and their related subroutines, as well as general subroutine traps. Includes some OS-Specific traps.

OS Traps

Interpolation Traps

Perl4-to-Perl5 traps having to do with how things get interpolated within certain expressions, statements, contexts, or whatever.

DBM Traps

General DBM traps.

Unclassified Traps

Everything else.

As always, if any of these are ever officially declared as bugs, they'll be fixed and removed.