#$topmargin = 0.60;
#$poleft = 0.4;
$pomiddle = 3.20;
$poright = 5.95;
$lheight = 1;
$row = int($opt{r}) || 1; # chop off any fractional parts and
$col = int($opt{c}) || 1;
if ($col == 1) {
$po = $poleft;
} elsif ($col == 2) {
$po = $pomiddle;
} else {
$po = $poright;
}
#
$sp = ($topmargin + ($row - 1)*$lheight);
####
1 fred jones
555-1212 123 Main St. Boston
MA 00001 test@test.com
2 mary smith
222-1515 321 Least St. Hanover
NH 02022 testmary@test.com
3 jack least
122-5511 231 Last St. Franklin
CT 06001 nomail@test.com
####
@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<
$CUSTID,$fname,$lname
@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<
$phone,$address,$city
@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<
$state,$zip,$email
####
use strict;
use warnings;
my @fields;
format =
@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<
@fields[ 0 .. 2 ]
@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<
@fields[ 3 .. 5 ]
@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<@<<<<<<<<<<<<<<<<
@fields[ 6 .. 8 ]
.
while ( ) {
@fields = split /,/;
write;
}
__DATA__
1,fred,jones,555-1212,123 Main St.,Boston,MA,00001,test@test.com
2,mary,smith,222-1515,321 Least St.,Hanover,NH,02022,testmary@test.com
3,jack,least,122-5511,231 Last St.,Franklin,CT,06001,nomail@test.com
####
use strict;
use warnings;
while ( ) {
my @fields = split /,/;
while ( my @chunk = splice @fields, 0, 3 ) {
printf "%-17s", $_ for @chunk;
print "\n";
}
}
__DATA__
1,fred,jones,555-1212,123 Main St.,Boston,MA,00001,test@test.com
2,mary,smith,222-1515,321 Least St.,Hanover,NH,02022,testmary@test.com
3,jack,least,122-5511,231 Last St.,Franklin,CT,06001,nomail@test.com