Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Simple way to split on last match?

by aturtle (Novice)
on Aug 05, 2012 at 20:36 UTC ( [id://985570]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://985570]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-18 18:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found