[sf-perl] use {strict,warnings}

Kevin Frost biztos at mac.com
Tue Mar 4 09:26:04 PST 2008


Sorry, I forgot how short the e-mail elves cut their lines.  Previous  
code, shorter width:

# You could do something like this:

# pretty ugly, but it works and the print didn't change:
my ( $alpha, $ralpha, $blvd ) =
   map { defined $_ ? $_ : '' }
   split( /\s+/, $phrase, 3 ), '', '', '';
print " 1: $alpha\n 2: $ralpha\n 3: $blvd\n\n";

# ...or like this:

my $i = 0;
print join( "\n", map { $i++; "$i: $_"; } split( /\s+/, $phrase ) ),
   "\n\n";

# ...or like this if you don't care about 4+:

my $i = 0;
print
   join( "\n", map { $i++; "$i: $_"; } split( /\s+/, $phrase, 3 ) ),
   "\n\n";




More information about the SanFrancisco-pm mailing list