#!/usr/bin/perl -w use strict; use Benchmark; our $s = "A" x 1024; timethese(1_000_000, { 'slash i' => sub { $s =~ /a/i; $s =~ /b/i; }, 'brackets' => sub { $s =~ /[Aa]/; $s =~ /[Bb]/; }, });