use strict; my $string = ' this that other '; $string =~ s/^\s+//; $string =~ s/\s+$//; my ($one, $two, $three) = split /\s+/, $string; print "$one\n$two\n$three\n\n"; #### /home/jptxs > perl -w stripNsplit this that other /home/jptxs >