in reply to matching single-quoted-like strings (q{}, q//)
I believe I got a version that runs a bit quicker this time:)
#! perl -slw use strict; my %lookup; @lookup{map chr, 32..127}=map chr, 32..127; @lookup{'{', '(', '[', '<'} = ('}', ')', ']', '>'); my $string = do{ local $/; <DATA>}; print "Match:'$2'" while $string =~ m[\bq(.)(.+?(??{ $lookup{$1} }))]s +og; __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};
|
|---|