I need some help with a perl script I'm writing at work.
Basically, this script grabs a HTML file from a server, and searches through it for certain data, and writes this data to a text file.
I'm having problems with the searching of the data. I'm a Java programmer and I know there is an index function in Java which works with a string and accepts a string parameter and returns the location in the first string where there is an instance that matches the string parameter. Is there any function like this in Perl (I'm sure there is!). Any help would be appreciated.
Basically, if I had a string "ABCDEFG", and I wanted to look for "CD", I'd like a function that searches through "ABCDEFG" and returns the location of CD in the string - if you're counting from 0, the location would be 2. I'd then want a function that can get a certain part of a string. Say I wanted CD and 2 letters following CD, I'd want it to return CDEF.
Can anybody help me with these two functions? Thanks in advance!
-GL
Basically, this script grabs a HTML file from a server, and searches through it for certain data, and writes this data to a text file.
I'm having problems with the searching of the data. I'm a Java programmer and I know there is an index function in Java which works with a string and accepts a string parameter and returns the location in the first string where there is an instance that matches the string parameter. Is there any function like this in Perl (I'm sure there is!). Any help would be appreciated.
Basically, if I had a string "ABCDEFG", and I wanted to look for "CD", I'd like a function that searches through "ABCDEFG" and returns the location of CD in the string - if you're counting from 0, the location would be 2. I'd then want a function that can get a certain part of a string. Say I wanted CD and 2 letters following CD, I'd want it to return CDEF.
Can anybody help me with these two functions? Thanks in advance!
-GL