in reply to arrays and strings
Here's how I'd approach it:
my @numbers = qw(1 2 2 3 3); my @strings = qw(hello green grass rainbow pretty); my @check = qw(1 2 3 4); my %concat; for (0 .. $#numbers) { $concat{$numbers[$_]} .= $strings[$_]; } for (@check) { print $concat{$_} || "xxxxxxxx", "\n"; }
|
|---|