[Chicago-talk] humbling question
tzz at lifelogs.com
Thu Sep 20 12:30:23 PDT 2007
On Thu, 20 Sep 2007 13:52:38 -0500 Jonathan Rockway <jon at jrock.us> wrote:
JR> On Wed, 2007-09-19 at 06:18 -0700, Richard Reina wrote:
>> print $i . " " . $name . " " $f_name . " " . $l_name . " " . $ph ."\n";
JR> One minor nit: perl will interpolate inside of double-quoted strings, so
JR> you could save yourself a lot of typing by writing:
JR> print "$i $name $f_name $l_name $ph\n";
JR> Much cleaner, eh?
I always prefer printf/sprintf for printing repetitive data, personally.
It separates formatting from data nicely (I know Perl has formats built
in, but printf is a universal skill :) The columns will line up nicely
too, if you specify the widths.
# just an example...
printf ("%05d %20s %20s %20s %-12s\n", $i, $name, $f_name, $l_name, $ph);
More information about the Chicago-talk