I was playing with index() in Perl today, which was a lot of fun. I started off with something similar to this code, which prints out the following:
Here is a list of my programming books 1 The Well-Grounded Rubyist 2 Pragmatic Thinking & Learning 3 Programming Ruby 1.9 4 Learning Perl
I learned how to use index() in the course I'm taking. In this example, I am using index() to print out ONLY Ruby books (and their ranking). I am aware that it's very redundant code (I'll change that later.)
Index() determines the position of a character in a string. If the string doesn't contain the character, index() will return -1.
Some interesting stuff I'm learning.