[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Variable Names in Formatted Output



I'm learning the examples from _Learning Perl on Win32 Systems_ using my 
PowerBook. The following example does not work correctly. It appears that I
am incorrectly specifying that columnz is a variable. The script just
outputs words, right-justified, in a column of an arbitrary width. What am I
doing wrong?

print "How many columns? ";
chomp ($columnz = <STDIN>);
print "Enter a list of words:\n";
chomp (@list = <STDIN>);
foreach (@list) {
 printf "%${columnz}s\n", $_;
 }

Robert Ligon


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org