in reply to Help with parsing a string

It seems that you're just trying to remove all whitespaces:
s/\s+//g;

Of course that doesn't verify your data, so you could use split instead (untested):

OUTER: while (<>){ chomp; my @items = split m/\s/; for my $i (@items) { last OUTER unless $i =~ m/^[a-f\d]{2}$/; } print join '', @items; }

Replies are listed 'Best First'.
Re^2: Help with parsing a string
by pc88mxer (Vicar) on Jul 22, 2008 at 21:31 UTC
    If you lines contain other text besides the hex numbers, you can restrict the space removal to just between the hex numbers with:
    $line =~ s{\b([a-f\d]{2})\s+(?=[a-f\d]{2}\b)}{$1}gi;