in reply to Some sexy regex

Must it be an array? I've had good luck with the transliteration operator:
my $good = "abcde"; my $bad = "zyxwv"; my $mixed = "azby"; for ($good, $bad, $mixed) { print "$_ contains invalid characters!\n" if tr/a-m//c; }
Yes, this approach has some limitations, the most severe being that tr/// doesn't perform variable interpolation. It's still nice to know.

Replies are listed 'Best First'.
Re: Re: Some sexy regex
by parv (Parson) on Mar 19, 2003 at 08:04 UTC
    tr/// not taking a regex is the most sever limitation for me. (Yeah, i know there is also s///.)