Created
December 2, 2016 12:01
-
-
Save mersanuzun/256964be910a77fccf0339e77b701fce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my ($type, $search_term) = @ARGV; | |
$file = 'parsed_tax_name.txt'; | |
sub get_tax_id_or_name{ | |
open(FILE, "<$file") or | |
die("Could not open log file. $!\n"); | |
while(<FILE>) { | |
if ($type eq "-t" and $_ =~ /$search_term\|(.*)/){ | |
return $1; | |
}elsif ($type eq "-n" and $_ =~ /(\d*)\|$search_term.*/){ | |
return $1; | |
} | |
} | |
} | |
print get_tax_id_or_name() , "\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment