in reply to Re: better way to convert a string into an array and an hash
in thread better way to convert a string into an array and an hash

May I recommend

while ($string =~ /(\d+):(\d+)(?:,|$)/g) { $hash{$1} = $2; push(@array, $1); }

over

$string =~ s/(\d+):(\d+)(?:,|$)/$hash{$1}=$2;push(@array, $1)/ge;