From 0093bf9b86f6ff94482225ae13c6a5fdba65ffb0 Mon Sep 17 00:00:00 2001 From: elserj Date: Tue, 16 Dec 2014 23:30:33 +0000 Subject: [PATCH] Use proper file handles, add a die if can't open file for writing svn path=/; revision=590 --- interactome_scripts/fasta_header_fix.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/interactome_scripts/fasta_header_fix.pl b/interactome_scripts/fasta_header_fix.pl index 9b72653..9635692 100755 --- a/interactome_scripts/fasta_header_fix.pl +++ b/interactome_scripts/fasta_header_fix.pl @@ -19,20 +19,20 @@ if($#ARGV != 1) { my $input_file = $ARGV[0]; my $output_file = $ARGV[1]; -open(in_file, $input_file) || die "Error: File $input_file can not be opened"; -open(out_file, ">$output_file"); +open(INFILE, $input_file) || die "Error: File $input_file can not be opened"; +open(OUTFILE, ">$output_file") || die "Error: File $output_file can not be opened"; my $species = find_species($input_file); -while() { +while() { my $line = $_; chomp $line; if ($line =~ /^>/) { my $gene = find_gene($line,$species); $line = ">" . "$gene"; } - print out_file "$line\n"; + print OUTFILE "$line\n"; } -close(in_file); -close(out_file); +close(INFILE); +close(OUTFILE); -- 2.34.1