in reply to Inventory List Sorting Question

The first thing to do is to split your data into an array of arrays.

As your data doesn't contain any duplicated values, this doesn't show that it will correctly sort by two or more fields, but it will. Translating column names to numbers is left as an exercise.

#! perl -slw use strict; my @inventory = ( [ qw'2003 abc rel 999' ], [ qw'1999 hds sdf 100' ], [qw'2010 kls pol 1400' ], );; while( my @order = split ' ', <STDIN> ) { print "@$_" for sort{ my $r; for(@order) { if( $a->[ $_ ] =~ m[^\d+$] && $b->[ $_ ] =~ m[^\d+$] ) { ( $r = $a->[ $_ ] <=> $b->[ $_ ] ) and last; } else { ( $r = $a->[ $_ ] cmp $b->[ $_ ] ) and last; } } $r } @inventory; } __END__ c:\test>junk42 0 1999 hds sdf 100 2003 abc rel 999 2010 kls pol 1400 1 2003 abc rel 999 1999 hds sdf 100 2010 kls pol 1400 2 2010 kls pol 1400 2003 abc rel 999 1999 hds sdf 100 3 1999 hds sdf 100 2003 abc rel 999 2010 kls pol 1400 1 2 2003 abc rel 999 1999 hds sdf 100 2010 kls pol 1400 ^Z

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy