($wanted) = $line =~ /(\S*)/; #### $_ = "fred xxxxxxx barney"; s/x*//; print; # fred xxxxxxx barney