e.g. @nums = ('0.0989999999999', '0.6799999999999', '0.0859999999999', '0.0239999999999'); @short_nums = ('0.099', '0.68', '0.086', '0.024'); @found = ('0.099', '0.086'); if (defined ($found[0])) { for (my $i =0; $i<@short_nums; $i++) { if ($found[0] == $short_nums[$i]) { push @new_array, $nums[$i]; } } } # etc ....