Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Splitting on a pattern once

by kiruthika.bkite (Scribe)
on Mar 18, 2010 at 10:47 UTC ( #829379=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Splitting on a pattern once
in thread Splitting on a pattern once

Is this you are expecting.
Example-1

my $str="1 2 3 4 590"; my ($a,$b)=split(/ ([^ ]+)$/, $str); print "a=$a\nb=$b\n";

Output
a=1 2 3 4
b=590

Example-2
my $str="1:2:3:4:590"; my ($a,$b)=split(/:([^:]+)$/, $str); print "a=$a\nb=$b\n";

Output
a=1:2:3:4
b=590


Comment on Re^3: Splitting on a pattern once
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2014-12-19 15:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (84 votes), past polls