Hi. I have 2 arrays, @result and @comment.
Result contains
1
2
3
and comment contains
a
b
c
my code is below
my @multi = (@result, @comment);
foreach (@multi)
{
print array;
}
For this I am getting result
1
2
3
a
b
c
But i want my result lilke
1 a
2 b
3 c
Please suggest me how to do that.
#!/usr/bin/perl
my @result=qw (1 2 3);
my @comment =qw (a b c );
my @multi = (@result,@comment);
my $scalar1=scalar @result;
my $scalar2=scalar @comment;
my $count=($scalar1 > $scalar2)?$scalar1:$scalar2;
for ( my $i=0;$i<$count;$i++)
{
print $result[$i],"\t",$comment[$i],"\n";
}
I did the below
$data_dir="/u001/data/slatrk/data";
open(F1,"<$data_dir/dev2.daily.perl") || die "Cannot open file1:$!\n";
open(F2,"<$data_dir/comments.dat") || die "Cannot open file2:$!\n";
while(<F1>){
chomp;
chomp(my $f2=<F2>);
push (@result, $_ . " " . $f2 . "\n");