in reply to Inconsistent for the sake of convenience

Here's an ugly one, perhaps the ugliest of them all:
$x[12]=$x[123]=$x=$_=""; print "match one\n" if /$x[123]/; print "match two\n" if /$x[12]/;
The output is "match two".

Replies are listed 'Best First'.
Re^2: Inconsistent for the sake of convenience
by codeacrobat (Chaplain) on Feb 17, 2009 at 21:26 UTC
    So totally awful, I'll have to clean it first.
    $ perl -MO=Deparse blurp.pl # normalize Code with B::Deparse $x[12] = $x[123] = $x = $_ = ''; print "match one\n" if /${x}[123]/; # array fail, characterclass win print "match two\n" if /$x[12]/; blurp.pl syntax OK

    print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});