in reply to Split string into hash

You don't have to split twice. Perl is smart enough to know how to load a flat list into a hash.

use strict; use warnings; use Data::Dumper; my $string = "1:one;2:two;3:three"; my %hash = split /[;:]/, $string; print Dumper \%hash;

The output is:

$VAR1 = { '1' => 'one', '3' => 'three', '2' => 'two' };

No guarantees as to the order, as hashes aren't sorted.


Dave