Hi all, I am getting some troubles with arrays. I have two array with multiple columns and I'd like to merge them side by side. I tryed the join function but the output that gives is only the first array after the second one, instead to put the second next to first. Not that the arrays has not the same number of columns but have the same number of lines
here the sample array i use to test my code:
array 1
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
5 6 7 8 9
array2
a b c d
b c d e
f g h i
l m n o
p q r s
output I expect to have:
1 2 3 4 5 a b c d
2 3 4 5 6 b c d e
3 4 5 6 7 f g h i
4 5 6 7 8 l m n o
5 6 7 8 9 p q r s
output I have with join:
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
5 6 7 8 9
a b c d
b c d e
f g h i
l m n o
p q r s
any help would be appreciated, thanks in advance Ause strict; use warnings; open (POSITION, "path to file"); my(@array1) = <POSITION> ; close POSITION ; open(APRI2, "path to file") ; my(@array2) = <APRI2>; close APRI2; my @join = (@array1, @array2); print @join; exit;
In reply to multicolumn files by Anto_ch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |