ultibuzz has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
after great help from tye and ambros on CB i get this code to work(regex done by tye and ambros)
here is some data#!"C:\perl\bin\perl.exe" use warnings; use strict; open(INFILE, '<', 'test_data.txt') or die("open failed: $!"); while (<INFILE>) { my ($ezb, $numbers) = split(';',$_); my( $pre, $in, $post )= $numbers =~ /^ ([^()]*) \( ([^()]*) \) ([^ +()]*) $/x; #my @number_split = split(',', $numbers); print "$pre\t$in\t$post\n"; }
201.1;201(27, 28, 3, 4, 83, 84, 890, 897, 898, 9), 2054 201.2;201(1, 20-26, 29, 80-82, 891-896, 899) 201.3;201(52-54, 6, 75, 76, 85-88) 201.4;201(50, 51, 55-59, 70-74, 77-79)
the above code works for the mentioned data.
now i get something like this data
2302.1;2302, 2304(3-8, 92-99), 2305(2, 4-9) 231.1;2301, 2303, 2304(1, 2, 90, 91), 2305(1, 3), 2306, 2307, 2308
best woud be if i can place every NUMBER(numbers) in one array and the rest in one array, the stuff infront of the ; can be ignored will be splited away
idears and help greatly welcome
i tryed splitting at ( and count and recombine but this ends in a mess of nonsens
kd ultibuzz
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Putting special elements from a row into an array
by agianni (Hermit) on Mar 22, 2007 at 12:59 UTC | |
by ultibuzz (Monk) on Mar 22, 2007 at 13:05 UTC | |
by agianni (Hermit) on Mar 22, 2007 at 14:20 UTC | |
by ultibuzz (Monk) on Mar 22, 2007 at 14:46 UTC | |
|
Re: Putting special elements from a row into an array
by shmem (Chancellor) on Mar 22, 2007 at 14:44 UTC | |
by ultibuzz (Monk) on Mar 22, 2007 at 15:17 UTC | |
by shmem (Chancellor) on Mar 22, 2007 at 15:27 UTC |