Note that when the string includes mixed quoting which is not valid in the OP's terms:
my $string = qq{var1='1' var2="2" var3="3" var4='4" var5="5' var6="correct"};
...hipowls non-5.10 version (5.10 not tested) produces "ugly" output in the sense used by almut and skeeve
var1 = 1
var2 = 2
var3 = 3
var4 = 4" var5="5
var6 = correct
More significantly, if $str is in the form:
my $string = qq{var1='1' var2="2" var3="3" var4='4" var5="5'
...the output becomes:
var1 = 1
var2 = 2
var3 = 3
var4 = 4" var5=
...which is the same as the output produced if var5 is properly quoted, var5='5':
my $string = qq{var1='1' var2="2" var3="3" var4='4" var5='5'};
i.e.,
var1 = 1
var2 = 2
var3 = 3
var4 = 4" var5=
That sort of ambiguity may be a problem for OP.
|