in reply to Character Index

Perl gives you many facilities for processing strings and it is generally (but not always) not idiomatically good to use low-level routines like 'index'.

Often processing using regular expressions is more suitable.

For example, code like (not tested, you get the idea):

# 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 #
You could instead do...:
( $token, $line ) = split( /\s+/, $line, 2 );
or even:
( $token, $line ) = $line =~ /^(\S+)\s+(\S+)$/;
It perhaps looks a little funnier if you are used to other languages and you are of course free to code how you want. But, IMHO you don't get the warm fuzzy perl feeling unless you are in the idiom.

Now someone is going to tell me how I should be doing the above in a much more efficient way ;-)

Hmmm...last thought is that if you don't have to deal with quoting issues (or you do and you are red hot at regexps ;-) you get to do things like:

@tokens = split( $line, /\s+/ ); # Split all words into the array foreach my $word ( @words ) { # drive state machine }
And lastly if you do have to deal with quoted whitespace etc (isn't the real world a tough place) you might find what you need in the Text::ParseWords module. (You shouldn't even have to go to CPAN for that...its part of the base install).