" btw, why did you say 4, not 5? 'Login' has 5 characters last time I
looked!"

I had a momentary (so I thought) lapse of confusion and applied the offset
rule to the
length (e.g. first character is 0).

"grab a copy of that part of the string, then throw it in to the great big
bit void in the sky"

That was stupid mistake....hello, no clue what I was thinking...

($mybit) = m#/nic/login/">([^<]*?)<#;

This explanation was extremely helpful!!!!

Thank you for taking the time explain each of my issues.

Another satisfied customer.....thank you again!!

Craig
[EMAIL PROTECTED]
Pager
Numeric: 1-877-895-3558
Email pager: [EMAIL PROTECTED]
--------------------------------------------------------------
You will never find time for anything.
If you want time, you must make it.

Charles Buxton

----- Original Message -----
From: "Me" <[EMAIL PROTECTED]>
To: "Craig S Monroe" <[EMAIL PROTECTED]>; "Beginners@Perl (E-mail)"
<[EMAIL PROTECTED]>
Sent: Wednesday, June 27, 2001 5:45 PM
Subject: Re: substr (help,help,help);


> > while (<SOURCE>){
> >  if (m/\/nic\/login/){
>
> this just says yes or no, you have a match or you don't.
> m// (and friends like s///) can do more than that for you.
> for one thing, they can grab a particular piece of what
> they match.
>
> >  substr ($_,28,4);
>
> what substr normally does -- get or change a piece of
> a string -- overlaps what m// and friends can do. if you
> are already using m// or friend it's often simpler to use
> that to do what substr can do.
>
> in the above case, substr isn't doing anything at all!
> you don't set that part of the string to anything, nor do
> you set any variable to contain the bit that's grabbed.
> you're simply saying, grab a copy of that part of the
> string, then throw it in to the great big bit void in the
> sky. you could do:
>
>     $foo = substr($_, 28, 4);
>
> but, as noted above, it's easier to extend your use of m//.
>
> btw, why did you say 4, not 5? 'Login' has 5 characters
> last time I looked!
>
> back to m//. Try this:
>
>     ($mybit) = m#/nic/login/">([^<]*?)<#;
>
> I used # as the m delimiters so you don't have
> to escape the / characters.
>
> the (...) is the bit that grabs something.
>
> the [^<] bit means match anything but a < character.
> the * bit means match any number of non <'s.
> the ? bit means match as few as still makes the
> match true (if possible). (otherwise the grabbed bit
> would be the rest of the line up to just before the last <
> encountered.
>

Reply via email to