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
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
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 =
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:
> 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 ",".
[
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
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