in reply to One Liner, print multiple regex matches

Another option with your data is to capture the text on either side of the equals sign:

perl -nle "print qq{$1 => $2} while /(\S+)=(\S+)/g" data.txt

Output:

name => abc dep => HR type => permanent age => 35 name => xyz dep => Sales type => contract age => 31

Replies are listed 'Best First'.
Re^2: One Liner, print multiple regex matches
by cipher (Acolyte) on Dec 18, 2012 at 22:45 UTC
    Thanks Kenosis. :)
      You're most welcome, cipher!