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

Re: Simple way to split on last match?

by johngg (Abbot)
on Aug 05, 2012 at 22:02 UTC ( #985573=note: print w/ replies, xml ) Need Help??


in reply to Simple way to split on last match?

Another way to do it, since your delimiter is invariate, would be to use substr and rindex.

[johngg@justy Documents]$ perl -E ' > $str = q{last -- From --00--SPLIT ?--11452}; > $delim = q{--}; > $last = substr $str, rindex( $str, $delim ) + length $delim; > say $last;' 11452 [johngg@justy Documents]$

I hope this is helpful.

Cheers,

JohnGG


Comment on Re: Simple way to split on last match?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2015-07-02 06:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (30 votes), past polls