in reply to converting an arbitrary string into a hash based on a pattern

you could try out this...
$x = 'ABCD----[this] fgab [that] AB CD EF -- [foo]'; $x =~ s/\s*([^\[]+?)\s*\-*\s*\[([^\]]+)\]/$myhash{$1} = $2;/ge; print Dumper(\%myhash);
-sampath

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
    Welcome to the monastery ssk.

    As this is your first post, you might find reading Perl Monks Approved HTML tags useful, especially the part about code-tags. If you follow the advice there your future writeups will look far better.
    For now, I considered your node to be janitored (to add code-tags).


    holli, /regexed monk/