in reply to Fetching last part of url

my $page; $something =~ m!([^/!]*$)! and $page = $1;
Update: fix typo: from  m!([^/!]*$)!to  m!([^/]*$)!.
Boris

Replies are listed 'Best First'.
Re^2: Fetching last part of url
by CombatSquirrel (Hermit) on Sep 09, 2004 at 17:10 UTC
    #!perl use strict; use warnings; my $myfetch = 'http:\\myurlinfo\mypage.html'; $myfetch =~ m!([^/!]*$)! ? print $1 : print 'Whoops...'; __END__ Unmatched [ in regex; marked by <-- HERE in m/([ <-- HERE ^// at (eval + 1) line 7.
    Probably you meant
    #!perl use strict; use warnings; my $myfetch = 'http:\\myurlinfo\mypage.html'; $myfetch =~ m!([^\\]+)$! ? print $1 : print 'Whoops...'; __END__ mypage.html

    Cheers,
    CombatSquirrel.

    Entropy is the tendency of everything going to hell.
      Oops, no I mean m!([^/]*$)! sorry.
      Boris