Hi Monks,
I was just wondering if someone could help me, the original file contains columns seperated by tabs, the coding then sorts that file and creates an output file (thank you choroba for helping me with that!) all i require is for the results in the output file to be separated by tabs, is this possible? if so how?
use warnings;
use strict;
my $infile = 'orders.txt';
my $output = 'orders_today.txt';
open (OUT, "+>$output");
open my $IN, '<', $infile or die "ERROR: Cannot open '$infile': $!";
my @out;
while (<$IN>) {
chomp;
my @text = split /\t/;
push @out, [@text];
}
open my $OUT, '>', $output or die "Cannot open '$output': $!";
#@$_ split /\t/;
print {$OUT} map "@$_\n", sort { $a->[10] cmp $b->[10] } @out;
thank you