in reply to why such an error happened?

#!/usr/bin/perl -- use warnings; use strict; use re 'debug'; my $chr = "this and that"; $chr =~ s/(this|that)|(\w+)/$1\U$2/g; #error reported print "$chr\n"; __END__
Compiling REx `(this|that)|(\w+)' size 19 Got 156 bytes for offset annotations. 1: BRANCH(12) 2: OPEN1(4) 4: BRANCH(7) 5: EXACT <this>(10) 7: BRANCH(10) 8: EXACT <that>(10) 10: CLOSE1(19) 12: BRANCH(19) 13: OPEN2(15) 15: PLUS(17) 16: ALNUM(0) 17: CLOSE2(19) 19: END(0) minlen 1 Offsets: [19] 0[0] 1[1] 0[0] 1[1] 2[4] 0[0] 6[1] 7[4] 0[0] 11[1] 0[0] 12[1] 13[1 +] 0[0] 16[1] 14[2] 17[1] 0[0] 18[0] Matching REx `(this|that)|(\w+)' against `this and that' Setting an EVAL scope, savestack=5 0 <> <this and tha> | 1: BRANCH Setting an EVAL scope, savestack=15 0 <> <this and tha> | 2: OPEN1 0 <> <this and tha> | 4: BRANCH Setting an EVAL scope, savestack=25 0 <> <this and tha> | 5: EXACT <this> 4 <this> < and tha> | 10: CLOSE1 4 <this> < and tha> | 19: END Match successful! Matching REx `(this|that)|(\w+)' against ` and that' Setting an EVAL scope, savestack=25 4 <this> < and tha> | 1: BRANCH Setting an EVAL scope, savestack=35 4 <this> < and tha> | 2: OPEN1 4 <this> < and tha> | 4: BRANCH Setting an EVAL scope, savestack=45 4 <this> < and tha> | 5: EXACT <this> failed... 4 <this> < and tha> | 8: EXACT <that> failed... Clearing an EVAL scope, savestack=35..45 4 <this> < and tha> | 13: OPEN2 4 <this> < and tha> | 15: PLUS ALNUM can match 0 times out of 2147483647.. +. Setting an EVAL scope, savestack=35 failed... Clearing an EVAL scope, savestack=25..35 Setting an EVAL scope, savestack=25 5 <this > <and tha> | 1: BRANCH Setting an EVAL scope, savestack=35 5 <this > <and tha> | 2: OPEN1 5 <this > <and tha> | 4: BRANCH Setting an EVAL scope, savestack=45 5 <this > <and tha> | 5: EXACT <this> failed... 5 <this > <and tha> | 8: EXACT <that> failed... Clearing an EVAL scope, savestack=35..45 5 <this > <and tha> | 13: OPEN2 5 <this > <and tha> | 15: PLUS ALNUM can match 3 times out of 2147483647.. +. Setting an EVAL scope, savestack=35 8 <his and> < that> | 17: CLOSE2 8 <his and> < that> | 19: END Match successful! Use of uninitialized value in concatenation (.) or string at 2 line 9. Matching REx `(this|that)|(\w+)' against ` that' Setting an EVAL scope, savestack=35 8 <his and> < that> | 1: BRANCH Setting an EVAL scope, savestack=45 8 <his and> < that> | 2: OPEN1 8 <his and> < that> | 4: BRANCH Setting an EVAL scope, savestack=55 8 <his and> < that> | 5: EXACT <this> failed... 8 <his and> < that> | 8: EXACT <that> failed... Clearing an EVAL scope, savestack=45..55 8 <his and> < that> | 13: OPEN2 8 <his and> < that> | 15: PLUS ALNUM can match 0 times out of 2147483647.. +. Setting an EVAL scope, savestack=45 failed... Clearing an EVAL scope, savestack=35..45 Setting an EVAL scope, savestack=35 9 <his and > <that> | 1: BRANCH Setting an EVAL scope, savestack=45 9 <his and > <that> | 2: OPEN1 9 <his and > <that> | 4: BRANCH Setting an EVAL scope, savestack=55 9 <his and > <that> | 5: EXACT <this> failed... 9 <his and > <that> | 8: EXACT <that> 13 <his and that> <> | 10: CLOSE1 13 <his and that> <> | 19: END Match successful! String too short [regexec_flags]... Match failed Freeing REx: `"(this|that)|(\\w+)"'