avanta has asked for the wisdom of the Perl Monks concerning the following question:
such that i wish to have the split output of each row aswww,google,yahoo,345 www,google,yahoo,75323
A simple split will split the string as$var1=www,google,yahoo $var2=345 and so on...
So if I wish to get the desired output I need to split at the last comma(,). How can I do it? Pleas help....$str="www,google,yahoo,345"; my ($var1,$var2)=split(/,/,$str); Output: $var1=www $var2=google
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: split a string at a defined index
by BrowserUk (Patriarch) on Mar 29, 2010 at 06:18 UTC | |
by AnomalousMonk (Archbishop) on Mar 29, 2010 at 08:09 UTC | |
by BrowserUk (Patriarch) on Mar 29, 2010 at 08:19 UTC | |
Re: split a string at a defined index
by wfsp (Abbot) on Mar 29, 2010 at 07:15 UTC | |
Re: split a string at a defined index
by almut (Canon) on Mar 29, 2010 at 07:16 UTC | |
Re: split a string at a defined index
by CountZero (Bishop) on Mar 29, 2010 at 06:40 UTC | |
Re: split a string at a defined index
by Anonymous Monk on Mar 29, 2010 at 05:50 UTC | |
Re: split a string at a defined index
by Punitha (Priest) on Mar 29, 2010 at 05:32 UTC | |
by smokemachine (Hermit) on Mar 29, 2010 at 10:58 UTC | |
Re: split a string at a defined index
by JavaFan (Canon) on Mar 29, 2010 at 14:11 UTC |