As is often the case with Perl, you can cheat. :)
#!/usr/bin/perl -w use strict; my $a = " a: b c: d e: f "; $a =~ y/://d; my %h = eval "qw/$a/"; # The Evil String Eval print "Key [$_] | Value [$h{$_}]\n" for keys %h;
-- Human history becomes more and more a race between education and catastrophe. -- HG Wells
In reply to Re: extracting the key value pairs from a string
by oko1
in thread extracting the key value pairs from a string
by mnranjeeth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |