ImpalaSS has asked for the wisdom of the Perl Monks concerning the following question:
21039pa 5005CamdenSouth.3 - 2.4 0.023 50.1 51.9 104.3 - 3.11% 17.43% 2.3% 0.63% 2.53% 30.79% 7.72% 7 0.52% 6 0.94% 16 0.44% 29 0 0.0% 0 0.0% nj5005CamdenSouth.3(5414) 2178aud 5449Pennington.1 - 8.7 0.392 17.4 8.5 34.5 - 2.84% 17.83% 25.1% 0.15% 2.94% 24.44% 33.24% 3 0.76% 49 4.82% 20 1.03% 72 0 0.0% 0 0.0% nj5449Pennington.1(12282) 6631pa 5384Chatsworth.1 - 11.0 0.459 12.5 13.2 36.7 - 2.81% 17.67% 30.0% 0.08% 5.28% 26.26% 67.66% 4 1.85% 14 8.81% 38 3.05% 56 3 0.0% 0 0.0% nj5384Chatsworth.1(5457) 15273pa 0395UpperOxford.3 - 2.3 0.048 10.5 11.6 24.4 - 2.79% 9.60% 9.5% 0.00% 4.00% 15.26% 45.62% 5 1.07% 0 0.00% 8 0.97% 13 0 0.0% 0 0.0% pa0395UpperOxford.3(12414) 19919pa 0539FisherPark.1 - 22.4 0.110 33.9 27.3 83.6 - 2.42% 16.54% 26.8% 0.14% 1.13% 32.59% 24.54% 3 0.80% 17 2.23% 16 0.70% 36 0 0.0% 0 0.0% pa0539FisherPark.1(19284) 27850pa 0557Poplar.2 - 0.5 0.170 14.0 6.0 20.5 - 2.34% 6.40% 2.5% 0.00% 1.90% 12.69% 46.68% 1 0.25% 1 1.64% 3 0.29% 5 0 0.0% 0 0.0% pa0557Poplar.2(14256) 4269aud 0886Longmead.2 - 0.2 0.083 2.8 2.2 5.2 - 2.27% 20.54% 3.6% 0.00% 16.07% 0.00% 10.53% 0 0.00% 0 0.00% 2 1.03% 2 0 0.0% 0 0.0% pa0886Longmead.2(37040) 15967pa 5458Kenmore.1 - 3.4 0.019 12.7 18.0 34.1 - 2.22% 18.03% 10.0% 0.12% 4.08% 39.05% 3.16% 11 1.10% 18 8.07% 14 0.84% 43 0 0.0% 0 0.0% md5458Kenmore.1(9399) 1727aud 5029Trenton.2 - 6.5 0.104 63.4 41.2 111.1 - 2.12% 14.48% 5.8% 0.01% 1.52% 38.73% 9.76% 11 0.66% 9 4.09% 39 0.97% 59 0 0.0% 0 0.0% nj5029Trenton.2(9324)The thing my boss wants me to do is take the 14th column and compare it to the 11th. And if the 14th is greater than the 11th, print it, if not, dont print it. This is my question, i did, :where sorted is the array (each row in the table is one item in the array).foreach $item(@sorted){ @new=split($item); print $new[13]; if($new[13] > $new [10]){ print $item; }
My goal being, taking each line, then splitting it, placing it in a new array, and then comparing and printing.
The problem however, is that when the array is split, i split it at the " " and they have a variable amount of spaces btwn fields to make the columns line up. Any help would be greatly appreciated.
Thanks in advance
Dipul
- Comment on Splitting Array with Variable Spaces
- Download Code
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Splitting Array with Variable Spaces
by btrott (Parson) on Nov 02, 2000 at 23:37 UTC | |
|
Re: Splitting Array with Variable Spaces
by mwp (Hermit) on Nov 02, 2000 at 23:39 UTC | |
|
Re: Splitting Array with Variable Spaces
by arturo (Vicar) on Nov 02, 2000 at 23:40 UTC | |
|
Re: Splitting Array with Variable Spaces
by fundflow (Chaplain) on Nov 03, 2000 at 00:11 UTC | |
|
awk and tr heresy (Re: Splitting Array with Variable Spaces)
by japhy (Canon) on Nov 03, 2000 at 02:25 UTC | |
|
RE: Splitting Array with Variable Spaces
by dws (Chancellor) on Nov 03, 2000 at 01:25 UTC | |
|
Re: Splitting Array with Variable Spaces
by ImpalaSS (Monk) on Nov 02, 2000 at 23:35 UTC | |
by Shendal (Hermit) on Nov 02, 2000 at 23:39 UTC | |
|
Re: Splitting Array with Variable Spaces
by Anonymous Monk on Nov 03, 2000 at 00:12 UTC | |
|
Re: Splitting Array with Variable Spaces
by ImpalaSS (Monk) on Nov 02, 2000 at 23:44 UTC |