#!/usr/bin/perl

sub mymap(&\@;@) {
  map &{$_[0]}, @{$_[1]};
}

@a = (1..3);
@b = (4..6);

print $_, "\n" for mymap { $_ * 3 } @a, @b;