my $word = 'sigma'; my $re = join '.*?', map quotemeta, split(//, $word); foreach my $text ( 'sigma', 'stigma', 'magma', ) { print("$text ", ($text =~ $re ? "matches" : "doesn't match"), "\n"); }