use 5.010_000; while ( $string =~ /(?\w+)=(?['"])(?.*?)\k/g) { say "$+{variable} = $+{value}"; }