@tokens = split( $line, /\s+/ ); # Split all words into the array foreach my $word ( @words ) { # drive state machine }