I'm writing two array contents to file:
@a1 = ('ABC', 'DEF', 'GHI');
@b1 = (1234, 6789, 7635);
open my $fh, ">", "log.txt" or die "Cannot open log.txt: $!";
foreach ( @a1, @a2 ) {
print $fh "$_\n";
}
close $fh;
Output:
ABC
DEF
GHI
1234
6789
7635
I want to write it to the log file in the following manner:
ABC 1234
DEF 6789
GHI 7635
I'm unsure how to achieve it.