in reply to # Translation

The second match in the flipflop operator /startpat/ ... /endpat/ destroys the captured Number ($1) of the left side. Consider these shell snippets.
# no regex in end pattern of flipflop $ echo "Curve4 " | perl -lne 'if (/Curve(\d+)/ ... eof) {print $1}' 4 # code similar to your example $ echo "Curve4 " | perl -lne 'if (/Curve(\d+)/ ... /^\s*/) {print $1}'

print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});