in reply to Walks like a regex, quacks like a regex...

Well, both  foo and (?-xism:$STUFF) are regular expressions and valid strings. A better way to distinguish the two is to look at the reference:
$reg = qr'foo'; $str = 'foo'; $str2 = '(?-xism:foo)'; $reg_ref = \$reg; $str_ref = \$str; $str2_ref = \$str2; print "$reg -> $reg_ref\n"; print "$str -> $str_ref\n"; print "$str2 -> $str2_ref\n";
yields
(?-xism:foo) -> REF(0x80635ac) foo -> SCALAR(0x80635dc) (?-xism:foo) -> SCALAR(0x8063600)

-Mark

Replies are listed 'Best First'.
Re: Re: Walks like a regex, quacks like a regex...
by legLess (Hermit) on Sep 23, 2003 at 04:17 UTC
    Nice test -- thanks.
    --
    man with no legs, inc.