The output of the following line of code is different than what is described in the text: "abcdef" =~ / .+ (?{say "Matched so far: $&"}) bcdef $/x; The text states that this prints the following: Matched so far: abcdef Matched so far: abcde Matched so far: abcd Matched so far: abc Matched so far: ab Matched so far: a But I am finding that only the last line gets printed: Matched so far: a One solution to get the output that the text describes is to slightly modify the code example to the following: "abcdef" =~ / .+ (?{say "Matched so far: $&"}) .cdef $/x;