Dear friends!
Please consult me!
How I must change the code ,so that "Raport page" prints on the begining of
file,not in the end?
Code reads the lines,count $env and $page and print those to the report
page...
Thank you,
VItali Pokrovski
------------------------------
Here is input file:
10Arve nr 1
20
0
30
0
90_ _
A01
10Arve nr 2
20
0
30
0
90__
A02
-----------------------------
while (<STDIN>) { # Read line by line
chomp;
if (substr($_,0,2) eq "10") {
s/10/\x0c10/; }
if (substr($_,0,1) ne " ") {
$pos = substr($_,0,1)} else {
substr ($_,0,1) = $pos; }
if (substr($_,0,5) eq "90_ _"){
++$env}
if (substr($_,0,2) eq "A0"){
++$page}
print "$_\n";
}
print "\x0c10 RAPORT PAGE\n";
print "10";
print "#" x 74;
print "\n";
print "10#Total is: $page pages and $env envelopes\n";
print "10#\n" x 10;
print "10";
print "#" x 74; # };
__EOF__
---------------------------------------
Now output file look like this:
10Arve nr 1
20
20
30
30
90_ _
A01
10Arve nr 2
20
20
30
30
90__
A02
10 RAPORT
10##########################################################################
10#Total is: 2 pages and 1 envelopes
10#
10#
10#
10#
10#
10#
10#
10#
10#
10#
10##########################################################################
----------------------------------------------------------------------------