Jakob Kofoed wrote at Thu, 30 May 2002 22:13:42 +0200:

Sorry, I don't know enough of the format command to help.
But that seems to be a little bit long.

> 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>);
> 
... and so on till
> print " \n";
> print "Enter DATA12 .................. ";
> chop($data12 = <STDIN>);

Let's make a loop:

my @data;
for (0 .. 12) {
     print "\nEnter Path DATA$_ file .. \n";
     chomp( $data[$_] = <STDIN> );
}

Now $file is in $data[0] and $data1 is in $data[1], ..., $data12 in $data[12].
Note, that I used chomp instead of chop, because it's safer.
Chomp removes a line end, chop removes always the last character of the string,
self it isn't a line ending.

I guess (as the group know - I'm not good in :-( )
you want first some heading information, looking like:

> 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

As I've already told, I don't know a lot about format.
But there are other ways, too. 
One is to exploit the powerful printf module,
another is:

open (FILE, "$data[0]") or die "...";
open (OUT, ">outfile.dat" or die "Don't forget that die ...";

print OUT <<INFO1_HEADER;
INFORMATION 1
_________________

TYPE........... : DATAINFO

INFO1_HEADER

print OUT "DATA$_..........: $data[$_]\n" for (1 ..9);

print OUT <<INFO2_HEADER;
INFORMATION 2
________________
print OUT "DATA$_ ........ : $data[$_]\n" for (10..12);

while (<FILE>) {
    my @elements = split /\s+/;
    print OUT join("\t", @elements);
}

close OUT;
close FILE;


The result won't be what you want,
but I hope I could help you anyway.

Cheers,
Janek

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

Reply via email to