RE: splitting a string

2003-12-10 Thread Tim Johnson
For those of you that are interested, I benchmarked a few of the suggestions. Drieux is by a significant margin the winner speed-wise. What I did was split the scalar into an array and then define the four variables by join()ing the result using an array slice instead of making a new array. Runn

RE: splitting a string

2003-12-10 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Ravi Malghan wrote: > Hi: I want to split the string > 0.0.0.0.1.10.1.30.1.10.1.30.1 > > into 4 variables: 0.0.0.0, 1, 10.1.30.1 and 10.1.30.1 > > any suggestions? > > TIA > ravi Here is one approach: #!perl -w use strict $_ = '0.0.0.0.1.10.1.30.1.10.1.30.1'; my @MyWorka = (); @MyWorka = spl

Re: splitting a string

2003-12-10 Thread drieux
On Dec 10, 2003, at 4:49 PM, Ravi Malghan wrote: Hi: I want to split the string 0.0.0.0.1.10.1.30.1.10.1.30.1 into 4 variables: 0.0.0.0, 1, 10.1.30.1 and 10.1.30.1 any suggestions? yes, get better data. a part of the problem you have is the that you could do this with a regEx my $input =

splitting a string

2003-12-10 Thread Ravi Malghan
Hi: I want to split the string 0.0.0.0.1.10.1.30.1.10.1.30.1 into 4 variables: 0.0.0.0, 1, 10.1.30.1 and 10.1.30.1 any suggestions? TIA ravi __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ -- To unsubscribe, e-mail:

Re: Splitting a string into a Array of Arrays

2001-07-31 Thread Rachel Coleman
> I know this is simpler then what I am making it but I am stumped. I used LWP::UserAgent to fetch some data from a > web page, What I need to do is to load the data which I believe is just one long string that I got from calling content() > into an array of arrays by splitting on "\n" and ",". [

RE: Splitting a string into a Array of Arrays

2001-07-31 Thread Mooney Christophe-CMOONEY1
You're actually very close. I would just change a couple of things. First of all, you don't need @data as well as @rows. $element is aliased to each element in the array as it loops, so you can re-assign right back into the same array when you split. This will cause the loop to independent of

Splitting a string into a Array of Arrays

2001-07-31 Thread Will Muir
I know this is simpler then what I am making it but I am stumped. I used LWP::UserAgent to fetch some data from a web page, What I need to do is to load the data which I believe is just one long string that I got from calling content() into an array of arrays by splitting on "\n" and ",". Lik