I'm currently modifying some code and wanted to add an additional argument to the code on the command line. The argument I added is the last one on the list.
#_ Command line options & setup filenames
for ($i=0; $i<=$#ARGV; $i++)
{
if($ARGV[$i] eq "-a")
{
$alignment_file = $ARGV[$i+1];
}
if($ARGV[$i] eq "-s")
{
$scorecons_file = $ARGV[$i+1];
}
if($ARGV[$i] eq "-i")
{
$image_file = $ARGV[$i+1];
}
if($ARGV[$i] eq "-m")
{
$numbered_model = $ARGV[$i+1];
}
if($ARGV[$i] eq "-c")
{
$csa_file = $ARGV[$i+1];
}
print "test $csa_file\n";
#_ Check for minimum number of command line argument variables
if($#ARGV < 6)
{
Usage();
print "NOT ENOUGH COMMAND LINE ARGUMENTS\n";
exit 0;
}
$fh_csa = new FileHandle($csa_file, "r") || die "Cannot open CSA f
+ile: $csa_file ($!)";
The code worked before I added the -c argument - i'm very confused as to why it doesn't work now. It doesn't seem obvious to me.
Ay suggestions much appreciated! I know the error means that the $csa_file variable isn't initialized but I fail to see how. I am of course remembering to input said argument at the prompt ;)