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; }
In Section
Seekers of Perl Wisdom