# store files in arrays open(A,'file_a'); my @a = (); close(A); open(B,'file_b'); my @b= (); close(B); # now the fun obfu bit my $max = [ @b + 0 => @a + 0 ] -> [ @b + 0 <= @a + 0 ]; for (0 .. $max) { print $a[$_] . $b[$_]; }