Maybe one of the guru's can help us, but here is one way:

#!perl -w

use strict;

my @a1 = ();    # leaving out $a1[1]  so undefined and can use the check of undefined 
in loop 
$a1[0] = 1;
$a1[2] = 3;
$a1[3] = 4;
$a1[4] = 5;
$a1[5] = 6;

my @b1 = (2,3,4,5,6,7);
my $Mya1;
my $Myb1;
my $MyId;

format HEADER =
Id  Test1            Test2
--- ---------------- ----------------
..

format NAME =
@>> @<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<
$MyId, $Mya1 , $Myb1
..

$~ = "HEADER";
write();
$~ = "NAME";

#select(STDOUT);
my $MyMax = scalar(@a1);
$MyMax = scalar(@b1) if ( scalar(@b1) > $MyMax);
for($MyId=0;$MyId<$MyMax;$MyId++) {
   $Mya1 = 'n';
   $Myb1 = 'n';
   $Mya1 = $a1[$MyId] if ( defined $a1[$MyId] and $a1[$MyId] gt '' );
   $Myb1 = $b1[$MyId] if ( defined $b1[$MyId] and $b1[$MyId] gt '' );
   write;
 } 

__END__

Output:
Id  Test1            Test2
--- ---------------- ----------------
  0 1                2
  1 n                3
  2 3                4
  3 4                5
  4 5                6
  5 6                7

Wags ;)

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 01, 2002 10:46
To: [EMAIL PROTECTED]
Subject: Formats, cont'd


I have two arrays, @array_a and @array_b, that contain info I want
formatted. I would like to have the output look something like:

dataset A                       dataset B
--------------------------------------------------------------
a1                              b1
a2                              b2
a3                              b3
.....
a(n)                            b(n)

where a1 is the first element of @array_a, b1 is the first element of
@array_b. Every time I try something, I get a runaway format, so nothing
gets printed to screen. Any ideas

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

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

Reply via email to