Hi sfrisch@mt.gov.
Please, I might be wrong here, but I don't see any "correlation" between the first part of your code and the input given.
However, the second part staring from this line:
# MOVe to running against the new file made sumery.txt
open FILE2,"sumfile.txt";
...
Suggested to me that the "input" given here should be data in your
sumfile.txt file. To which you needed to sort.
If the above is correct and this
"Out put is the same only sorted that is what I am shooting for.".
I think a
Schwartzian Transform could work for you like so:
#!/usr/bin/perl
use warnings;
use strict;
my @data_array;
while (<DATA>) {
chomp;
next if $_ eq '';
push @data_array, $_;
}
print map { $_->[0], $/ }
sort { $a->[1] <=> $b->[1] }
map { /.+?([0-9]+?)\s/; [ $_, $1 ] } @data_array;
__DATA__
DOABIL3020 ITSD-ENT_OP-DMSB-DIDS Ora
DOABIL309 EXE-SOS-3201_DFLT Ora
DOABIL3400 ITSD-ENT_OP-ETSB-MID PRD
DOABIL5310 ITSD-ENT_OP-ETSB-MID TST
DOABIL6230 EXE-SOS-3201_DFLT PRD
DOABIL7001 ITSD-ENT_OP-ETSB-EAS PRD
DOABIL7005 ITSD-ENT_OP-AIMB-DCSEC PRD
DOABIL7006 ITSD-ENT_OP-AIMB-DCSEC PRD
DOABIL7504 EXE-SOS-3201_DFLT PRD
DOABIL7581 ITSD-ENT_OP-NTSB-NET PRD
DOABIL7582 ITSD-ENT_OP-NTSB-NET PRD
DOABIL7583 ITSD-ENT_OP-NTSB-NET PRD
Output:
DOABIL309 EXE-SOS-3201_DFLT Ora
DOABIL3020 ITSD-ENT_OP-DMSB-DIDS Ora
DOABIL3400 ITSD-ENT_OP-ETSB-MID PRD
DOABIL5310 ITSD-ENT_OP-ETSB-MID TST
DOABIL6230 EXE-SOS-3201_DFLT PRD
DOABIL7001 ITSD-ENT_OP-ETSB-EAS PRD
DOABIL7005 ITSD-ENT_OP-AIMB-DCSEC PRD
DOABIL7006 ITSD-ENT_OP-AIMB-DCSEC PRD
DOABIL7504 EXE-SOS-3201_DFLT PRD
DOABIL7581 ITSD-ENT_OP-NTSB-NET PRD
DOABIL7582 ITSD-ENT_OP-NTSB-NET PRD
DOABIL7583 ITSD-ENT_OP-NTSB-NET PRD
I sorted using the first column.
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