in reply to converting an arbitrary string into a hash based on a pattern
-sampath$x = 'ABCD----[this] fgab [that] AB CD EF -- [foo]'; $x =~ s/\s*([^\[]+?)\s*\-*\s*\[([^\]]+)\]/$myhash{$1} = $2;/ge; print Dumper(\%myhash);
2005-03-05 Janitored by Arunbear - added code tags, as per Monastery guidelines
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: converting an arbitrary string into a hash based on a pattern
by holli (Abbot) on Mar 04, 2005 at 10:13 UTC |