use strict; my $test="*abc abc* 9- -**** *"; my (@x) = $test=~m/([*a-zA-Z0-9_-]+)/g; print scalar @x, qq/ Fundstellen\n/;