M
Marshall Dudley
Given the following:
$string = "start:a-b,c-d,e-f";
$string =~ /start?\w+)\-(\w+),?)+/;
print "1 -> $1=$2\n2 -> $3=$4\n3 -> $5=$6\n";
I would expect:
1 -> a=b
2 -> c=d
3 -> e=f
but am getting:
1 -> e=f
2 -> =
3 -> =
Is there any way to loop an unknown number of pairs, and get them shoved
into the backreferences instead of them always overwriting the first
two? This is a simplication of the actual problem and I cannot use the
g)lobal designation in the match due to other constraints.
Thanks,
Marshall
$string = "start:a-b,c-d,e-f";
$string =~ /start?\w+)\-(\w+),?)+/;
print "1 -> $1=$2\n2 -> $3=$4\n3 -> $5=$6\n";
I would expect:
1 -> a=b
2 -> c=d
3 -> e=f
but am getting:
1 -> e=f
2 -> =
3 -> =
Is there any way to loop an unknown number of pairs, and get them shoved
into the backreferences instead of them always overwriting the first
two? This is a simplication of the actual problem and I cannot use the
g)lobal designation in the match due to other constraints.
Thanks,
Marshall