I'd recommend you check out woolfy's Where and how to start learning Perl as there are some strange assumptions here, but a possible rewrite:
use strict;
use warnings; #good!
use Win32::OLE;
use Date::Calc; why load when you don't use it, or Win32::OLE?
#having a few variable with a large lexical scope isn't
#nessarily bad but in general use the smallest scope
# This acutally assigns the file location to a scalar
# doesn't get anything (as [holli] stated)
my %header_data;
my $f_mfg_desk = '//163.../chicago_wip_query.txt';
# Since you don't actually use @headers: I dropped it
# If you needed it just say why and I'll go from there
# "time" gives seconds after epoch which is proably not what you want,
+ see localtime*
my ($sec, $min, $hour, $dayofmonth, $month, $year, $weekday, $day) = l
+ocaltime(time);
$month++;
$year += 1900;
open (INFILE, $f_mfg_desk);
#if you do my $record = <INFILE> you'd need chomp($record);... or
while (<INFILE>)
{
chomp;
my @newrow = split /\t/;
#missing the ]; here
$header_data{$newrow[2]} = [ $newrow[3..18] ];
}
close(INFILE);
#to sort and reprint (proably want to copy a backup too)
open (OUTFILE, ">$f_mfg_desk");
# see perldsc* and sort*
for my $key (sort keys %header_data)
{
#see perlref* for @{}
for my $a (@{$header_data{$key}})
{
print OUTFILE "$a\t";
}
print OUTFILE "\n";
}
*:localtime, perldsc, sort, perlref
"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce