#!/usr/bin/perl -w use strict; use warnings; use diagnostics; use Getopt::Std; #reading options our ($opt_i); getopts('i:'); if (!$opt_i) { print STDERR "\nInput file name (-i) required\n\n\n"; } #open the file or die open INFILE, "<", $opt_i or die "No such input file $opt_i"; my %file; while () { #remove the newline character chomp; #create an array my @fh = ; #split the file by tabs in each row @fh = split ('\t', $_); #place the first column (row names) in $geno my $geno = shift @fh; my $remain = join "_", @fh[1-]; push @{$geno{$remain}}, $_; } # print the first field (the username) print "%file\n"; } close INFILE;