|
Posted by Gunnar Hjalmarsson on March 8, 2008, 9:21 am
Please log in for more thread options
[ You shouldn't have started a new thread for the same problem! ]
Deepan - M.Sc(SE) - 03MW06 wrote:
> Hi,
> I would like to thank everyone for their help to my previous
> post. Actually i didn't explained my need completely. Here's it
>
> my $url = "/pages-cell.net/deepan/sony/";
>
> if($url =~ m/\/(.*)\//g)
> {
> my @result = $1;
> return @result;
> }
>
> What i need is that i should be able to extract "sony" from it. In the
> sense i should be able to extract whatever that is available in the
> last between "/" and "/". Please help me to solve this.
This can still be easiest solved with split().
( split /\//, $url )[-1]
Otherwise you can do:
if ( $url =~ m#.*/(.+)/# ) {
print "$1\n";
}
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
|