my @filesize_names = qw(bit nibble byte kilobyte megabyte gigabyte terabyte petabyte exabyte zettabyte yottabyte); my $word = 'fubar'; $word =~ s/s$//; my @short_sizes = apply {$_ =~ s/^(\w)\w{1,}$/$1b/} @filesize_names; print Dumper(\@filesize_names); print Dumper(\@short_sizes); if (grep(lc $word,@short_sizes)) { # even 'fubar' greps print "$word grepped!"; $word = $filesize_names[firstidx { $_ eq lc $word } @short_sizes]; } print $word;