use File::Basename; $infile_name = shift(@ARGV); if ( ! -r $infile_name) { print STDERR "1.Cannot read $infile_name\n"; exit 99; } #### 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 directory as above if not equal to version.(Replace log/* with abinitio/run) } else { (our $graph_dir = $mon_dir)=~ s?log/.*$?$ver_name/abinitio/run?; #Build directory as such if equal to verion(Replace log/* with $ver_name/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; }