- or download this
my $str = "this,ok,that,cool,free,dom";
for my $key (sort keys (%hash = split /,/, $str)) {
...
}
- or download this
for my $key (sort keys %{ $hashref = { split /,/, $str } }) {
...
}
- or download this
for my $key (sort keys %{ +{%hash = split /,/, $str} }) {
...
}
- or download this
for my $pair (sort($str =~ /([^,]*,[^,]*)(?:,|$)/g)) {
my ($k, $v) = split /,/, $pair;
...
}