If I understood your question, this ll finish your job. But I think this is not efficient way, this can be still done with simple logic.
use strict;
use warnings;
while (<DATA>) {
chomp;
my $dic = $_;
my (@arr) = $dic =~ /([abort])/g; #get the matching letters
+
my %unique;
my $str = join "", grep (!$unique{$_}++, @arr); #make the gr
+epped letters unique
print $dic, "\n" if ($str eq 'abort'); #print if the order is
+ a, b, o, r, t
};
prints:
-------
abort
abortion
__DATA__
abroad
abort
abortion
boat
boaring
boart
As imp said, when i tested your code it works fine for me as well.