Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 studying the Monastery: (5)
As of 2014-09-15 05:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (145 votes), past polls