use warnings; use strict; die < source file to be processed Output is printed to stdout HELP while (<>) { chomp; print join ' ', grep {/^[+-]?\d+(\.\d*)?$/} split; print "\n"; }