SPUG: Minimal Perl book released today!

John W. Krahn krahnj at telus.net
Thu Sep 7 20:58:45 PDT 2006

Tim Maher wrote:
> SPUGsters,
> My book on Perl is finally available. In fact, it's /so/ available
> that you can even get two of its twelve chapters for free from the
> publisher's web site!

A couple of errata for your new book:   :-)

> Table 3.5 Compact character-class shortcuts
> Shortcut metacharacter Name Equivalent character class a
> \w Word character [a-zA-Z0-9_]
> \W Non-word character [^a-zA-Z0-9_]
> \s Whitespace character [\040\t\r\n\cJ\cL]
> \S Non-whitespace character [^\040\t\r\n\cJ\cL]
> \d Digit character [0-9]
> \D Non-digit character [^0-9]
> a. The backslashed sequences in the (square-bracketed) character classes are described in table 3.1.

While not an error the "\n" character is included twice, once by the "\n"
representation and once by the "\cJ" representation, and the character "\cL"
could also be represented as "\f".  Also the \w character class could include
more than just a-zA-Z0-9_ if the current locale supports it.

> 8.1.1 Defining defined
> To help you appreciate the value of defined, we’ll first illustrate a common problem
> that it can solve. Consider these lines from some-script, which might appear at the
> top of a script that requires arguments:
> $ARGV > 0 or warn "$0: No arguments!\n" and exit 255;
> $pattern=$ARGV[0];

$ARGV > 0

Should be:

@ARGV > 0

use Perl;

More information about the spug-list mailing list