Help for this page

Select Code to Download


  1. 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
    #
    
  2. or download this
    ( $token, $line ) = split( /\s+/, $line, 2 );
    
  3. or download this
    ( $token, $line ) = $line =~ /^(\S+)\s+(\S+)$/;
    
  4. or download this
    @tokens = split( $line, /\s+/ );  # Split all words into the array
    foreach my $word ( @words ) {
      # drive state machine
    }