Michael Goopta wrote:
> I am new to Perl.
> 
> How can I split the below string and get the multiple
> web-addresses in a list: (i.e. the strings between <upsl-url>
> and </upsl-url>
> 
> <upsl-url>http://view-preprod.admission.net/abc/mactive/_NJMG_0002029003-01/i-1.JPG?t=tr/m:FitPad/w:199/h:124&amp;t=ts/r:199x199</upsl-url><upsl-url>http://view-preprod.admission.net/abc/mactive/_NJMG_0002029003-01/i-1.JPG?t=tr/m:FitPad/w:199/h:124&amp;t=ts/r:199x199</upsl-url>
> </ad-type>

Well, what have you tried so far? You should first try to get it
working, and then ask an specific question.

This is nasty, but may work for all URLs on the string starting with
<upsl-url> and ending in </upsl-url>.

$string =~ s/\A<upsl\-url>//;
$string =~ s/<\/upsl\-url>\z//;

my @urls = split /<\/upsl\-url><upsl\-url>/, $string;

Does the trick. I guess :-)

-- 
David Moreno Garza <[EMAIL PROTECTED]> | http://www.damog.net/
 Pobre México: Tan lejos de Dios, tan cerca de los Estados Unidos.


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


Reply via email to