On 2/8/06, Mike Blezien <[EMAIL PROTECTED]> wrote:

> this is what I ended up doing and it seems to work, unless you see a potiental
> problem with it:
>
> $imageURL =~ /<IMG SRC=\"picserve.cgi\?picserve=\/(.*)\" BORDER=0>/;
> $audioimage = $1;
>
> this give the image filename i needed.

Cool! I'm glad you got it to work. And, so long as you don't mind that
the pattern is fragile, I don't have a problem with it. By fragile, I
mean that any small change in the syntax of the HTML is likely to make
it fail to match:

    <IMG SRC='picserve.cgi?picserve=/thebest_Small.png'  Border="0" >

I don't know the details of your situation, so I can't know whether
this matters. If you know that your input data is restricted to what
your pattern matches, that the syntax will never change, that nobody
will ever add height, width, alt text, or other attributes to your
tags, then go for it. Or you can use a module.

In normal usage, it's best to check the return value of your pattern
match: If it's false, the match failed, $1 may have a value left over
from a previous pattern match, and you may want to die() to alert the
user that the pattern needs to be tweaked.

Cheers!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to