On Sun, 18 Mar 2018 12:32:44 +0100
hw <h...@adminart.net> wrote:

> John SJ Anderson <j...@genehack.org> writes:
> 
> >> But this one in its place does not work:
> >> if ($link =~ m/\/([^/]*)$/) { # Oddly this does not work  
> >
> > You still need to escape the `/` inside the character class.
> >
> > This works in my testing: `m/\/([^\/]*)$/`.
> >
> > IMO this is a case where an alternative delimiter for `m//` — such as the
> > `#` in your working example — is a better approach.   
> 
> IIRC it´s said in best practises or so that brackets ({, }) should be
> used for an alternative delimiter and that they should probably be the
> only substitute to use.
> 

I don't blindly follow https://en.wikipedia.org/wiki/Perl_Best_Practices and
disagree about this. I find it useful to use #, % and other delimiters which do
not naturally occur in regexes or otherwise.


-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Selina Mandrake - The Slayer (Buffy parody) - http://shlom.in/selina

*Chuck*: Indeed. Anyway, I invited a friend who is even crazier than I am.
*Kermit*: Really, who is this crazy guy?
*Chuck*: Actually, it’s a crazy girl.
    — http://is.gd/htmOCv

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to