On Thursday, May 23, 2002, at 12:04 , Lance Prais wrote:

> I am trying to use the substr() to search a text doc.   The starting place
> is 100.
>
> I am trying to test to see if   "Sleeping for 10"  is there.
>
> This is the code I am trying to use substr($line 100,16)  but is only
> returning "Sleeping f"
>
> What could I be doing wrong?


if ( length($line) >= 116 ) ....

then you would rather expect that it would return
what you were expecting....  but it would seem
that you have read in only 110 characters.....

eg:

        my $line = 'some
        other stuff
        stuff here and "Sleeping for 10"
        and just some junk for fun';

        my $len = length($line);

        print substr($line, 70,16);

does not generate a string 'sixteen characters' long....

you may want to think of the problem in terms of a
multi line Regular Expression.... ala say:

        http://www.wetware.com/drieux/pbl/RegEx/paraHablarRegular.txt

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to