OK try
#!perl use strict; use Data::Dumper; my $str = 'eab12345 a b c id=00000 x= pgrp=abc=defgh groups=abcdefgh a +nd more roles='; my @f = split / (\w+=)/,$str; my @array = (); while (@f){ my $k = shift @f; if ($k =~ /=$/){ my $v = shift @f; push @array,"$k$v"; } else { # key no equal push @array,"$_=" for split /\s+/,$k; } } print Dumper \@array;
In reply to Re^7: Splitting a long row with multiple delimiters.
by poj
in thread Splitting a long row with multiple delimiters.
by dipit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |