in reply to
Re: Simple way to split on last match?
in thread
Simple way to split on last match?
Hey thanks! my ($last) = (split(/--/, $line))
-1
; Works The
-1
is what is significant in getting the last one i guess. -Turtle
Comment on
Re^2: Simple way to split on last match?
Replies are listed 'Best First'.
Re^3: Simple way to split on last match?
by
Marshall
(Canon)
on Aug 08, 2012 at 04:39 UTC
Yes that is correct.
A Perl "list slice" can have indices of
[-3,2,-1,3,-4]
in any order. The one thing that I wish Perl could do that it cannot do: is to say "I want all of the stuff past index X" in a simple syntax.
[reply]
[d/l]
In Section
Seekers of Perl Wisdom