# Remove leading and trailing whitespace. $str =~ s{\A \* | \s* \z}{}gxm; #### if ($str =~ /nbk[A-z0-9]{4}/ or /nbd[A-z0-9]{4}/ or /root/){