From 5c87f4b673edad87a64044e7e4d8c3e6776c7c4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Josef=20=C5=A0pa=C4=8Dek?= Date: Thu, 23 Feb 2023 19:12:30 +0100 Subject: [PATCH] Fix undefined $unkpos RT#146697 --- lib/Text/Balanced.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Text/Balanced.pm b/lib/Text/Balanced.pm index 960609c..aa87898 100644 --- a/lib/Text/Balanced.pm +++ b/lib/Text/Balanced.pm @@ -1005,7 +1005,8 @@ sub extract_multiple (;$$$$) # ($text, $functions_ref, $max_fields, $ignoreun { $unkpos = pos($$textref)-1 unless $igunk || defined $unkpos; - _update_patvalid($textref, substr $$textref, $unkpos, pos($$textref)-$unkpos); + _update_patvalid($textref, substr $$textref, defined $unkpos ? $unkpos : 0, + pos($$textref) - (defined $unkpos ? $unkpos : 0)); } }