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,

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

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 = split(/\./,

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.

Re: Splitting a string

2002-09-08 Thread Janek Schleicher
Janek Schleicher wrote at Sat, 07 Sep 2002 10:06:34 +0200: ... print join \n, grep defined, ($string =~ /(.*?)|(\w+)/g); ... The regexp matches either (.*?) in $1 or (\w+) in $1. ^^ Of course, I meant $2. But the regexp always makes a

Re: Splitting a string

2002-09-07 Thread Janek Schleicher
Wiggins D'Anconia wrote at Sat, 07 Sep 2002 05:34:55 +0200: Octavian Rasnita wrote: Hi and thank you. It works! Could you explain me please in a few words what is this line doing exactly? I want to learn. print join \n, grep defined, ($string =~ /(.*?)|(\w+)/g); [snipped very good

Re: Splitting a string

2002-09-06 Thread Janek Schleicher
Octavian Rasnita wrote at Thu, 05 Sep 2002 20:09:58 +0200: I want to split a string but it is a little too complicated for me. If it is too complicated, don't give me an answer but just a little hint to the right direction. I have a string like the following example (used to search in a

Re: Splitting a string

2002-09-06 Thread zentara
On Thu, 5 Sep 2002 21:09:58 +0300, [EMAIL PROTECTED] (Octavian Rasnita) wrote: I want to split a string but it is a little too complicated for me. If it is too complicated, don't give me an answer but just a little hint to the right direction. I have a string like the following example (used to

Re: Splitting a string

2002-09-06 Thread Octavian Rasnita
PROTECTED] Sent: Friday, September 06, 2002 2:54 PM Subject: Re: Splitting a string Octavian Rasnita wrote at Thu, 05 Sep 2002 20:09:58 +0200: I want to split a string but it is a little too complicated for me. If it is too complicated, don't give me an answer but just a little hint to the right

Re: Splitting a string

2002-09-06 Thread Wiggins d'Anconia
:54 PM Subject: Re: Splitting a string Octavian Rasnita wrote at Thu, 05 Sep 2002 20:09:58 +0200: I want to split a string but it is a little too complicated for me. If it is too complicated, don't give me an answer but just a little hint to the right direction. I have a string like

Splitting a string

2002-09-05 Thread Octavian Rasnita
Hi all, I want to split a string but it is a little too complicated for me. If it is too complicated, don't give me an answer but just a little hint to the right direction. I have a string like the following example (used to search in a search engine): perl editor free blind accessible I

Re: Splitting a string

2002-09-05 Thread Wiggins d'Anconia
I am sure one of the gurus probably has a cool regex to do this, but I haven't gotten to that book yet ;-) One solution and by no means the fastest or shortest, would be to split on space, then step through your returned list checking the beginning of each element, if that element

Re: splitting the string.

2002-03-22 Thread Jim Conner
I know many have probably answered this but Im just going down my email list. Here is the answer: @asplit = split(//,$a); That should be it. - Jim At 22:41 03.20.2002 -0800, Raja Gopal wrote: Hello Perl Experts, I want to split the string $a =abcdef; as @asplit = (a,b,c,d,e,f). Is

RE: splitting the string.

2002-03-21 Thread Veeraraju_Mareddi
$a ='abcdef'; @arr = split(//,$a); print @arr; -- From: Raja Gopal[SMTP:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 12:11 PM To: [EMAIL PROTECTED] Subject: splitting the string. Hello Perl Experts, I want to split the string $a =abcdef

RE: splitting the string.

2002-03-21 Thread Nisim, Amit
just do $a =abcdef; @asplit = split //,$a; Amit -Original Message- From: Raja Gopal [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 8:41 AM To: [EMAIL PROTECTED] Subject: splitting the string. Hello Perl Experts, I want to split the string $a =abcdef; as @asplit

Re: custom splitting of string

2001-12-18 Thread Jenda Krynicky
Jenda Krynicky wrote: John W. Krahn [EMAIL PROTECTED] suggested: my @s = split //, $s; my @s = unpack 'a' x length $s, $s; my @s = $s =~ /./gs; push @s, substr $s, $_, 1 for 0 .. length $s - 1; push @s, chr vec $s, $_, 8 for 0 .. length $s - 1; Also

Re: custom splitting of string

2001-12-17 Thread John W. Krahn
Jenda Krynicky wrote: John W. Krahn [EMAIL PROTECTED] suggested: my @s = split //, $s; my @s = unpack 'a' x length $s, $s; my @s = $s =~ /./gs; push @s, substr $s, $_, 1 for 0 .. length $s - 1; push @s, chr vec $s, $_, 8 for 0 .. length $s - 1; Also unshift @s,

custom splitting of string

2001-12-16 Thread I.J.
If I have a string $s='ABC'; how can I split it into one-char-long-element-array like @s=('A','B','C'); and, generally how can I access individual characters of a string variable? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: custom splitting of string

2001-12-16 Thread John W. Krahn
I.J. wrote: If I have a string $s='ABC'; how can I split it into one-char-long-element-array like @s=('A','B','C'); and, generally how can I access individual characters of a string variable? my @s = split //, $s; my @s = unpack 'a' x length $s, $s; my @s = $s =~ /./gs; push @s,

Re: custom splitting of string

2001-12-16 Thread Paul Johnson
On Sun, Dec 16, 2001 at 06:19:40AM -0800, John W. Krahn wrote: I.J. wrote: If I have a string $s='ABC'; how can I split it into one-char-long-element-array like @s=('A','B','C'); and, generally how can I access individual characters of a string variable? substr() But might I

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