in reply to Can this code be optimized further?

This is not an optimization, but for the sake of TIMTOWTDI:
#!/usr/bin/perl -w use strict; my @temp=("a_1","b_1","a_2","a_3","a_4","b_2","a_5","b_3","a_6","b_4") +; my (@a, @b) ; my %dispatch = ( "a" => sub { push @a, shift }, "b" => sub { push @b, shift }, ); foreach my $value (@temp) { if ( $value =~ /^([ab])_(.+)$/ ) { my $sub = $dispatch{$1}; &$sub($2); } } print "@a <==> @b\n";
holli, /regexed monk/