in reply to matching single-quoted-like strings (q{}, q//)

This seems reasonably efficient to work:/

Update:I screwed up my benchmark, this is way slow compared to your method.

#! perl -slw use strict; my %lookup = ('{'=>'}', '('=>')', '['=>']', '<'=>'>'); my $re_q = qr[\bq(.)(.*?)(?<!\\)(??{ $lookup{$1}||$1 })]so; my $string = do{ local $/; <DATA>}; print "Match:'$2'" while $string =~ m[$re_q]g; __DATA__ my $km = q'BEGIN simple foo bar baz END'; my $kv = q#BEGIN foo bar \# baz END#; my $kk = q{BEGIN super foo bar banzai END}; my $kt = q{BEGIN super foo \{super\} bar banzai END};

Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.