-
Notifications
You must be signed in to change notification settings - Fork 14
/
common_stuff.pm
48 lines (42 loc) · 1.42 KB
/
common_stuff.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl -w
#------------------------------------------------------------------------
#---- common_stuff.pm ----
#------------------------------------------------------------------------
package common_stuff;
use strict;
#use PostData;
use FileHandle;
#-----------------------------------------------------------------------------
#----------------------------------- MAIN ------------------------------------
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#----------------------------------FUNCTIONS----------------------------------
#-----------------------------------------------------------------------------
sub build_lu{
my $file = shift;
my %lu;
my $fh = new FileHandle;
$fh->open($file);
while (defined(my $line = <$fh>)){
chomp($line);
$lu{$line}=1;
}
$fh->close();
return (\%lu);
}
#-----------------------------------------------------------------------------
sub build_match_lu{
my $file = shift;
my %lu;
my $fh = new FileHandle;
$fh->open($file);
while (defined(my $line = <$fh>)){
chomp($line);
my @stuff = split(/\t/, $line);
$lu{$stuff[0]}=$stuff[1];
}
$fh->close();
return (\%lu);
}
#-----------------------------------------------------------------------------
1;