in reply to Split String after nth occurrence of a charater
#! usr/bin/perl my ($occ,$str); $str="hi there this is perl monks forum."; print "enter number of occurence where you want to split\n"; $occ=<STDIN>; chomp($occ); $str=~ /(\S+\s){$occ}/; print "left : $& \nRight: $'\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Split String after nth occurrence of a charater
by JavaFan (Canon) on Nov 08, 2011 at 07:30 UTC |