Effective Perl Programming: Ways to Write Better, More by Joseph N. Hall

By Joseph N. Hall

The vintage consultant to fixing Real-World issues of Perl—Now absolutely up-to-date for Today’s top Idioms!

 

For years, skilled programmers have trusted Effective Perl Programming to notice larger how you can resolve issues of Perl. Now, during this long-awaited moment variation, 3 well known Perl programmers collect today’s top idioms, ideas, and examples: every little thing you want to write extra robust, fluent, expressive, and succinct code with Perl.

 

Nearly two times the dimensions of the 1st version, Effective Perl Programming, moment variation, offers every little thing from principles of thumb to prevent universal pitfalls to the most recent knowledge for utilizing Perl modules. You won’t simply examine the precise how one can use Perl: You’ll examine why those methods paintings so well.

 

New insurance during this version includes

 

  • Reorganized and extended fabric spanning twelve years of Perl evolution
  • Eight new chapters on CPAN, databases, distributions, documents and filehandles, construction Perl, trying out, Unicode, and warnings
  • Updates for Perl 5.12, the most recent model of Perl
  • Systematically up-to-date examples reflecting today’s top idioms

 

You’ll tips on how to paintings with strings, numbers, lists, arrays, strictures, namespaces, general expressions, subroutines, references, distributions, inline code, warnings, Perl::Tidy, information munging, Perl one-liners, and an entire lot extra. each method is equipped within the related goods structure that helped make the 1st version so handy and popular.

Show description

Read Online or Download Effective Perl Programming: Ways to Write Better, More Idiomatic Perl (2nd Edition) (Effective Software Development Series) PDF

Best javascript books

Beginning Backbone.js

Starting spine. js is your step by step consultant to studying and utilizing the spine. js library on your net initiatives. spine. js is without doubt one of the preferred JavaScript libraries between internet builders, used to create modular, single-page net apps. This publication takes you from downloading spine. js and its dependencies all of the option to utilizing extra complicated libraries to constitution your program structure, and every thing in among.

Javascript 1.1 Developer's Guide

A certified developer's reference for boosting commercial-grade websites explains the right way to use JavaScript to hyperlink applets, multimedia courses, plugins, and extra. unique. (Advanced).

Beginning JSP, JSF and Tomcat: Java Web Development

Commence construction Java–based internet purposes now, whether you’re a whole newcomer to Java. entire and example–driven, starting JSP, JSF, and Tomcat: Java internet improvement, moment version is all you want to advance dynamic Java-based net functions utilizing JSP, hook up with databases with JSF, and placed them into motion utilizing the world’s hottest open resource Java net server, Apache Tomcat.

Clojure for Java Developers

Key FeaturesWrite apps for the multithreaded international with Clojure's style of useful programmingDiscover Clojure's positive factors and merits and use them on your latest projectsThe booklet is designed in order that you may be capable positioned to take advantage of your present abilities and software program wisdom to turn into a more advantageous Clojure developerBook DescriptionWe have reached some extent the place machines aren't getting a lot swifter, software program initiatives have to be introduced fast, and top of the range in software program is extra not easy as ever.

Extra info for Effective Perl Programming: Ways to Write Better, More Idiomatic Perl (2nd Edition) (Effective Software Development Series)

Example text

Know which values are false and test them accordingly ❘ 25 } -e syntax OK If you want to use another variable to hold the line you just read, you have to do the defined check yourself: while ( defined( my $line = ) ) { do_something($line); } The end of the array The mere fact that an array element is not defined doesn’t mean that you’ve gone beyond the bounds of the array. P. Roscoe You don’t want to use the value to decide whether you have gone through each element of the array: while ( defined( my $cat = shift @cats ) ) { # WRONG print "I have a cat named $cat\n"; } Instead, ensure that you go through all of the elements by using foreach, and skip those that aren’t defined: foreach my $cat (@cats) { next unless defined $cat; print "I have a cat named $cat\n"; } If you need to know the last element of the array, don’t look for undef values.

9 ]; @list[ reverse 5 .. 9 ] = @list[ 5 .. 9 ]; Slices provide a handy way to swap two elements: @a[ $n, $m ] = @a[ $m, $n ]; @item{ 'old', # swap $a[$m] and $a[$n] 'new' } = @item{ 'new', 'old' }; # swap $item{old} and # $item{new} Use slices to reorder arrays Slices are also used in sorting (Item 22). Given two parallel arrays @uid and @name, this example sorts @name according to the numerical contents of @uid. The sort orders the indices in @name, uses that sorted list as a slice, then assigns the slice back to @name: @name = @name[ sort { $uid[$a] <=> $uid[$b] } 0 ..

Operator, ||, and &&), it is first converted to a string (Item 8). Perl then tests the string result. If the result is the empty string, or a string consisting exactly of the single character '0', the result is false. Otherwise, the result is true. Note that this rule means that undef will evaluate as false, since it always looks like 0 or the empty string to everything except the defined operator. 24 ❘ Chapter 1 The Basics of Perl This generally works very well. If problems arise, it’s probably because you tested a quantity to see if it is false when really you should have tested to see if it is defined: while ( my $file = glob('*') ) { # WRONG do_something($file); } That glob works well almost all of the time.

Download PDF sample

Rated 4.27 of 5 – based on 20 votes