in reply to Return value from a binding operator?
In list context the match returns a list of those (grouped) submatches.
In this case everything "non /" [^/] between one or none slash /? and end of string $.
HTH =)
Cheers Rolf
( addicted to the Perl Programming Language)
EDIT: I'm not sure if it makes sense to put $ is within the group. Not my style...
CAREFUL!!!
This Basename() routine is dangerous cause it expects a scalar to be returned but only in list context!
DB<116> $0="a/b" => "a/b" DB<117> @a=Basename() => "b" # all grouped matches DB<118> $a=Basename() => 1 # true it matched
Plz be aware that the context is propageted to return.
thx Athanasius for spotting the same problem... race condition between my update and your post :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Return value from a binding operator?
by Athanasius (Archbishop) on Apr 12, 2013 at 16:35 UTC | |
by LanX (Saint) on Apr 12, 2013 at 16:57 UTC | |
|
Re: Return value from a binding operator?
by Spinone (Novice) on Apr 12, 2013 at 22:47 UTC | |
by LanX (Saint) on Apr 12, 2013 at 23:09 UTC |