I'll help what I can. You need to store the input and not print it out until after you've printed out your raport. I'm not sure what you are doing, so I haven't tried to fix anything except the printing of the report. If this code is going to be in use for a while, it would be good for you to add more comments, and use a better style for indenting.
/\/\ark my @inputarray = (); 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} # Save the input to an array and print it out later #print "$_\n"; push @inputarray,"$_\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; print "\n"; #print the input array foreach (@inputarray) {print} __EOF__ -----Original Message----- From: Vitali [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 6:00 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: How to print firstly Raport page ,and after data from input file 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 ----------------------------- my @inputarray = (); 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} # Save the input to an array and print it out later #print "$_\n"; push @inputarray,"$_\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; # }; #print the input array foreach (@inputarray) {print}; __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########################################################################## ---------------------------------------------------------------------------- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]