#!/usr/bin/perl use warnings; use strict; use Data::Dumper; #link to input file from command line - 2 arguments or error displayed; Set to respective variables @ARGV == 2 or die "Invalid number or arguments. Please re-run program and supply as arguments: \n1) the filter file and \n2) the input file."; my ($filter_file, $input_file) = @ARGV; open (FILTER,"$filter_file"); my @filter; ; # read one line from the file [HEADERS] while () { # read other lines chomp; # remove "\n" from the end of the line push @filter,[(split /\t/,$_)]; # create an array of the line by splitting it by , make a reference of it and push the reference to the @filter array close $filter_file if eof; } @filter = sort { $a->[5] <=> $b->[5] } @filter; # sort the array #PRINTS REFERENCES TO ARRAY FROM LEAST TO GREATEST REGARDING 'ORDER' COLUMN print Dumper \@filter; #### For Debugging Purposes my $num_elements = (@filter-1); #Number of elements in array - will be used to control loop when comparisons take place later in code