script from class

3 views
Skip to first unread message

Sofia Robb

unread,
Nov 9, 2011, 3:35:32 PM11/9/11
to ucr-perl-bi...@googlegroups.com

#!/usr/bin/perl -w
use strict;
use Data::Dumper;

#shift takes 0th element from cmdline array @ARGV
my $file = shift;

open INFILE, "$file" or die "Can't open $file $!\n";
my %hash;

while (my $line = <INFILE>){
        chomp $line;
        #my @line = split /\t/ , $line;
        my ($gene, $location1, @rest) = split /\t/ , $line;
        $hash{$gene} = [$location1 , $location2];
        #print "$zero -- $first -- $second\n";
}

## $hash{'geneB'} will return the entire array
#my @locs =  @ { $hash{'geneB'} } ;
#print location2 of geneB
my $loc =  ${ $hash{'geneB'} }[1];
print $loc ,"\n";


#print Dumper \%hash;


--
Sofia Robb, Ph.D
Stajich Lab
University of California Riverside


Reply all
Reply to author
Forward
0 new messages