use strict;
use warnings;
# Formats
my ($crt, $text, $num);
format =
@< @<<<<<<<< @###.##
$crt, $text, $num
.
format STDOUT_TOP =
@|||||||||||||||||||||
"Example Format"
----------------------
Nr Text Number
-- -------- --------
.
my $total = 0;
format RAPORT_TOTAL =
----------------------
@###.##
$total
----------------------
.
# End formats
while (<DATA>) {
s /[\n|\r]//g; # clean
($crt, $text, $num) = split(/;/, $_, 3);
$total += $num;
write();
}
# Change format
$~ = "RAPORT_TOTAL";
write();
__DATA__
1;some data;123.34
2;other;432.54
3;testing;123.55
Regards, Stefan |