Hi,
I have a large pipe delimited text file that i want to loop through and sort
out a column of data within that file. Let's call this column $sizes. I want to
group these different sizes into categories. i.e.
@sizeA = ("A","B","C");
@sizeB = ("D","E","F");
@sizeC = ("G","H","I");
This is what i want to do:
If $sizes is in @sizeA
print the sizes that are listed in @sizeA
If $sizes is in @sizeB
print the sizes that are listed in @sizeB
same for @sizeC.
Could someone show me how to do this? Below is what i have so far. Thanks.
#!/usr/bin/perl
use strict;
use warnings;
open(IN, $ARGV[0]) || die "Could not open data file: $ARGV[0]\n";
my @sizes = (<IN>);
foreach my $line (@sizes)
{
# split rows into columns
my @fields = split "\t", $line;
my $size = $fields[2];
}
close(IN);
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/