Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Contents

1. What Is Perl?
2. Course Requisites and Goals
3. Perl References & Resources
4. State of Perl
5. Taste of Perl
6. Storing & Running Perl Programs
7. The Elements
8. Literals & Operators
    9. Loops and I/O
10. Grade Book Example
11. Pipe I/O and System Calls
12. Matching
13. Parsing
14. Simple CGI
15. Testing Perl Programs
16. Common Goofs

16. Common Goofs for Novices

Adapted from Programming Perl, page 361.
  1. Testing "all-at-once" instead of incrementally, either bottom-up or top-down.
  2. Optimistically skipping print scaffolding to dump values and show progress.
  3. Not running with the perl -w switch to catch obvious typographical errors.
  4. Leaving off $ or @ or % from the front of a variable, or omitting & when invoking a subroutine in Perl 4.
  5. Forgetting the trailing semicolon.
  6. Forgetting curly braces around a block.
  7. Unbalanced (), {}, [], "", '', ``, and sometimes <>.
  8. Mixing '' and "", or / and \.
  9. Using == instead of eq, != instead of ne, = instead of ==, etc. ('White' == 'Black') and ($x = 5) evaluate as (0 == 0) and (5) and thus are true!
  10. Using "else if" instead of "elsif".
  11. Not chopping the output of backquotes `date` or not chopping input:
        print "Enter y to proceed: ";
        $ans = <STDIN>;
        chop $ans;
        if ($ans eq 'y') { print "You said y\n";}
        else { print "You did not say 'y'\n";}
    
  12. Putting a comma after the file handle in a print statement.
  13. Forgetting that Perl array subscripts and string indexes normally start at 0, not 1.
  14. Using $_, $1, or other side-effect variables, then modifying the code in a way that unknowingly affects or is affected by these.
  15. Forgetting that regular expressions are greedy, seeking the longest match not the shortest match.



 
 
[an error occurred while processing this directive]