in reply to Variable Declaration

You know what would help? If you post some code that can be run and demonstrates the problem, including the complete error message. By vaguely describing the problem from memory, you're just making it hard for us to see what the problem is, and therefore you're making the chances of you getting a correct answer a lot smaller.

Please read how (not) to ask a question, and writeup formatting tips. As in: use <code> tags for your code.

Replies are listed 'Best First'.
Re^2: Variable Declaration
by pp (Novice) on Aug 31, 2007 at 16:00 UTC
    Here is the code:
    use File::Basename; $infile_name = shift(@ARGV); if ( ! -r $infile_name) { print STDERR "1.Cannot read $infile_name\n"; exit 99; }
    a few more lines in between and in the main program I have the following:
    my $ver_name = shift @ARGV; my $mon_dir = dirname($infile_name); # Get directory if (! -z $ver_name) { (our $graph_dir = $mon_dir) =~ s?log/.*$?abinitio/run?; #Build dire +ctory as above if not equal to version.(Replace log/* with abinitio/r +un) } else { (our $graph_dir = $mon_dir)=~ s?log/.*$?$ver_name/abinitio/run?; #Build directory as such if equal to verion(Replace log/* with $ver_na +me/abinitio/run) } my $graph = "$graph_dir" . "/" . "$graphname"; # Concatenate graph directory with graphname if ( ! -r $graph) { print STDERR "2. Cannot read graph=$graph\n" exit 99; }
    By including the if-then-else condition I am getting the following error that it "Cannot read graph=********(pathname)
      A second error you haven't noticed yet: $? is a variable name. Perhaps you wanted \$?, although .*\$? is the same as just .*.