in reply to Re^2: Splitting on a pattern once
in thread Splitting on a pattern once
Is this you are expecting.
Example-1
Output
a=1 2 3 4
b=590
Example-2
Output
a=1:2:3:4
b=590
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
|
---|
In Section
Seekers of Perl Wisdom