Home > programming > perl for hashing

perl for hashing


#!/usr/bin/perl -w

open (EOUT1, “name1.txt”) || warn “wout.txt not open!!\n”;
open (EOUT2, “name2.txt”) || warn “wout.txt not open!!\n”;
open (EIN, “>ein.txt”) || warn “win.txt not open!!\n”;

while (<EOUT1>) {
chomp;
@a=split(/\t/,$_);
$gene{$a[0]}=$a[1];
}
close (EOUT1);

while (<EOUT2>){
chomp;
#@_=split(/\t/,$_);
if($gene{$_}){
print EIN $_, “\t”, $gene{$_}, “\n”;
}else{
print EIN $_, “\n”;
}
}
close(EOUT2);
close (EIN);

Advertisements
Categories: programming
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: