- or download this
# Pull token from line (Not good perl style)
$end = index( $line, / /, 0 );
$token = substr( $line, 0, $end );
$line = substr( $line, $end ); # still need to lose whitespace
#
- or download this
( $token, $line ) = split( /\s+/, $line, 2 );
- or download this
( $token, $line ) = $line =~ /^(\S+)\s+(\S+)$/;
- or download this
@tokens = split( $line, /\s+/ ); # Split all words into the array
foreach my $word ( @words ) {
# drive state machine
}