in reply to Use of Uninitialized in Concatenation or String Error?
Hi ccelt09,
With the description of what you want to achieve, I suppose it all comes down to sorting your data with respect to the 5th column and then printing those out in different files ( correct me please if am wrong ) with respect to the range of the same column ( being between 1 and 1000,000,.. etc, 1 inclusive. Making the range 1000,000).
So, if assumption of what you wanted to do is correct, modifying Schwartzian transform a bit should work like so:
Produces ...use warnings; use strict; use Data::Dumper; push my @array, map { [ int( $_->[1] / 1_000_000 ), $_->[0] ] } sort { $a->[1] <=> $b->[1] } map { [ $_, ( split /\s+/, $_ )[4] ] } <DATA>; print Dumper \@array; __DATA__ 0 50 4 46 723430 0 2 1 2 1 1 1 1 + 3 1 0 50 4 46 5533723430 0 2 1 2 1 1 1 + 1 3 1 0 50 4 46 33723430 0 2 1 2 1 1 1 1 + 3 1 0 50 2 48 654732 0 1 1 1 0 2 3 2 + 1 3
$VAR1 = [ [ 0, '0 50 2 48 654732 0 1 1 1 0 +2 3 2 1 3 ' ], [ 0, '0 50 4 46 723430 0 2 1 2 1 +1 1 1 3 1 ' ], [ 33, '0 50 4 46 33723430 0 2 1 2 1 + 1 1 1 3 1 ' ], [ 5533, '0 50 4 46 5533723430 0 2 1 2 1 + 1 1 1 3 1 ' ] ];
Am using data as posted by Loops and in fact his solution might be better.
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
In Section
Seekers of Perl Wisdom