Hi,

I have a problem using the "format STDOUT =" in a Perl script.

The script takes a six columns data file - puts header on top of the
data (with different input - variables defined manually). 

The script write the input to the screen but not a file - I have tried
but can only get the data and not the header in the output file.

Another problem: how can I put the two last numbers in line one (only
these two) into two variables? That is: row 5 and 6 - column 1.

Hope you can help :-)

Cheers,
Jakob


Data file:

315.60     143.60       0.00       0.00  12.3  26.0
386.00     214.00       0.63     141.06  12.5  26.5
411.00     239.00       0.66     137.26  12.0  26.8
436.00     264.00       0.73     135.12  12.2  26.1
461.00     288.99       0.95     137.08  12.8  26.1
483.00     310.99       1.03     146.05  12.8  26.1
508.00     335.98       1.27     147.78  12.6  26.4
533.00     360.98       1.55     146.19  12.5  26.6
558.00     385.96       1.96     146.01  12.0  26.7


Perl script:

#!/usr/bin/perl5.6.1
print "Enter Path DATA file .. \n";
chop($file = <STDIN>);

print " \n"; 
print "Enter DATA1 ................... ";
chop($data1 = <STDIN>);

print " \n";
print "Enter DATA2 ................... ";
chop($data2 = <STDIN>);

print " \n";
print "Enter DATA3 ................... ";
chop($data3 = <STDIN>);

print " \n";
print "Enter DATA4 ................... ";
chop($data3 = <STDIN>);

print " \n";
print "Enter DATA5 ................... ";
chop($data5 = <STDIN>);

print " \n";
print "Enter DATA6 ................... ";
chop($data6 = <STDIN>);

print " \n";
print "Enter DATA7 ................... ";
chop($data7 = <STDIN>);

print " \n";
print "EnterDATA8 .................... ";
chop($data8 = <STDIN>);

print " \n";
print "Enter DATA9 ................... ";
chop($data9 = <STDIN>);

print " \n";
print "Enter DATA10 .................. ";
chop($data10 = <STDIN>);

print " \n";
print "Enter DATA11 .................. ";
chop($data11 = <STDIN>);

print " \n";
print "Enter DATA12 .................. ";
chop($data12 = <STDIN>);

open (xx, "$file") || die "Can't open input file!";
open (OUT, ">outfile.dat"); 
$= = 1000000
while (<xx>) {
        ($a,$b,$c,$d,$e,$f) = split(/\s+/);
        print OUT $_;  #It writes to the outfile.dat - but only data
                       #just not the header!
        write;
}
close xx;
close OUT
format STDOUT =
@>>>>>>>>>> @>>>>>>>>> @>>>>>>>>> @>>>>>>>>> @>>>>>>>>> @>>>>>>>>>>
$$a,$b,$c,$d,$e,$f
..
format STDOUT_TOP =

INFORMATION 1
_________________

TYPE........... : DATAINFO
DATA1.......... : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$data1
DATA2.......... : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$data2
DATA3.......... : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$data3
DATA4.......... : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$data4
DATA5.......... : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$dat5
DATA6.......... : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$data6
DATA7 ..........: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$data7
DATA8.......... : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$data8
DATA9 ..........: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$data9



INFORMATION 2
________________

DATA10 ........ : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$data10
DATA11......... : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$data11
DATA12......... : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$data12
-----------------------

H

INFORMATION 3
___________

         aa         bb         cc         dd        ee           ff
___________ __________ __________ __________ _________  ___________
@>>>>>>>>>> @>>>>>>>>> @>>>>>>>>> @>>>>>>>>> @>>>>>>>>> @>>>>>>>>>>
$a,$b,$c,$d,$e,$f
..


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to