in reply to How to split a non even number of string elements into a hash [RESOLVED]
my $str = "one 1 two 2 three 3 odd_element"; my $cnt = () = $str =~ /(\s)/g; # count spaces my %hash = split /\s/, $str, $cnt + 1; # split on spaces + 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to split a non even number of string elements into a hash [RESOLVED]
by thanos1983 (Parson) on Feb 10, 2017 at 12:05 UTC |