OK - I give up. I've spent the past hour trying to figure out why I don't get values printed for $nr, $price and $totamt.
Here's the code:
We all know that it's something really, really obvious but I'll be darned if I see it.
Comments/slings and/or arrows/suggestions accepted gracefully.
Tnx.
Tom
"My mind is like a steel whatchamacallit ...
Here's the code:
Code:
#!/usr/bin/perl
$totnritems = 0;
$mdsetotal = 0;
$~ = STDOUT_TOP;
$~ = HEADER_LINE;
write;
$~ = DETAIL_LINE;
format STDOUT_TOP =
COMPANY NAME, INC.
I N V O I C E
.
format HEADER_LINE =
-------------------------------------------------------
Item # Description Qty Price Total
-------------------------------------------------------
.
format DETAIL_LINE =
@<<<<<<<< @<<<<<<<<<<<<<<<<<<<< @## ###.## ####.##
$itemnr, $descr, $nr, $price, $totamt
.
format TOTAL =
-------------------------------------------------------
Totals @### @####.##
$totnritems, $mdsetotal
.
format ADDLCHGS =
@####.##
.
$line = "AUSMIX25|Australia Mix (25)|1|1.00";
($itemnr, $descr, $nr, $price) = split(/\|/, $line);
$totamt = $nr * $price;
$nr = sprintf("%03d",$nr);
$price = sprintf("%03.%02", $price);
$totamt = sprintf("%04.%02", $totamt);
write;
We all know that it's something really, really obvious but I'll be darned if I see it.
Comments/slings and/or arrows/suggestions accepted gracefully.
Tnx.
Tom
"My mind is like a steel whatchamacallit ...