Finding index of white space in Perl

Viewed 1449

I'm trying to find the index of white space in a string in Perl.

For example, if I have the string

stuff/more stuffhere

I'd like to select the word "more" with a substring method. I can find the index of "/" but haven't figured out how to find the index of white space. The length of the substring I'm trying to select will vary, so I can't hard code the index. There will only be one white space in the string (other than those after the end of the string).

Also, if anybody has any better ideas of how to do this, I'd appreciate hearing them. I'm fairly new to programming so I'm open to advice. Thanks.

4 Answers
Related