in reply to Regular expressions - match
Could I interest you in a more modern data structure for your result, a hash for example?
#!/usr/bin/perl use warnings; my $string = "one=1,three=3,five=5"; %f=map {m/(\w+)=(.*)/} split /,/, $string; use Data::Dumper; print Dumper(\%f); #prints $VAR1 = { 'three' => '3', 'five' => '5', 'one' => '1' };
|
|---|