From 0eebba3b9a243269d25de0e405b34494677db4f9 Mon Sep 17 00:00:00 2001 From: elserj Date: Wed, 22 Sep 2010 20:24:02 +0000 Subject: [PATCH] Exit script if wrong number of arguments is found svn path=/; revision=44 --- interactome_scripts/fasta_header_fix.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/interactome_scripts/fasta_header_fix.pl b/interactome_scripts/fasta_header_fix.pl index 4027a5d..f943e61 100755 --- a/interactome_scripts/fasta_header_fix.pl +++ b/interactome_scripts/fasta_header_fix.pl @@ -7,13 +7,14 @@ require "$ENV{HOME}/scripts/jaiswallab/interactome_scripts/find_species.pl"; my @files; -if($#ARGV == 1) { - $input_file = $ARGV[0]; - $output_file = $ARGV[1]; -}else{ +if($#ARGV != 1) { print "Usage: fasta_header_fix.pl input_file output_file\n"; + exit; } +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"); @@ -30,4 +31,4 @@ while() { } close(in_file); -close(out_file);} +close(out_file); -- 2.34.1