in reply to Re: Collapsing repetitive equality tests: || vs {} vs // (an observation)
in thread Collapsing repetitive equality tests: || vs {} vs // (an observation)

You missed /^[ABC]\z/ which should be faster than an alternation (but is only viable with one letter options). I also wonder about length($str)==1 && $str=~/[ABC]/

---
$world=~s/war/peace/g

Replies are listed 'Best First'.
Re^3: Collapsing repetitive equality tests: || vs {} vs // (an observation)
by ikegami (Patriarch) on Feb 25, 2007 at 23:30 UTC

    I took A, B and C to be placeholders for longer strings, so I purposefully didn't include the character class. I even mentioned I should have tested with longer strings as well.

    Feel free to add those tests and publish the results.