my $str = " foo bar baz "; my @spl = split $str; print "@spl"; #### while ( ) { split; #do something interesting; }