Kažkaip šiandien varčiausi Perlo dokumentaciją ir aptikau labai
naudingą Perlo pragmą, kuri padeda geriau išsiaiškinti kaip veikia
įpraiškos. Tereikia parašyti use re 'debug'; ir
visas įpraiškų paieškos procesas atsiveria prieš jus ;) Štai pavyzdys:
use re 'debug'; my $f = 'foo'; $a =~ /o+/;
Spausdina:
Compiling REx `o+' size 4 Got 36 bytes for offset annotations. first at 2 1: PLUS(4) 2: EXACT <o>(0) 4: END(0) anchored `o' at 0 (checking anchored) plus minlen 1 Offsets: [4] 2[1] 1[1] 0[0] 3[0] Guessing start of match, REx `o+' against `foo'... Found anchored substr `o' at offset 1... Starting position does not contradict /^/m... Guessed: match at offset 1 Matching REx `o+' against `oo' Setting an EVAL scope, savestack=3 1 <f> <oo> | 1: PLUS EXACT <o> can match 2 times out of 2147483647... Setting an EVAL scope, savestack=3 3 <foo> <> | 4: END Match successful! Freeing REx: `"o+"'