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
In reply to Re: One Liner, print multiple regex matches
by Kenosis
in thread One Liner, print multiple regex matches
by cipher
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |