in reply to reverse chop/string chop ?

You can do this without reverse or chop, with a one-liner:
my $URL = "http://www.mysite.com/images/uploads/1050084447_4.jpg"; # retrieves the image name from the URL my $image_name = (split /\//, $URL)[-1]; print "$image_name\n";
Which prints:
1050084447_4.jpg

Replies are listed 'Best First'.
Re: Re: reverse chop/string chop ?
by sauoq (Abbot) on Oct 22, 2003 at 06:44 UTC

    There's no reason to use split either...

    my ($file) = $url =~ m!([^/]*)$!;

    -sauoq
    "My two cents aren't worth a dime.";
    
Re: Re: reverse chop/string chop ?
by th3monk3y (Novice) on Oct 22, 2003 at 04:04 UTC
    works like a charm!
    thanks guys!