On 9/25/2013 2:38 PM, Renato wrote:

Hi, all.

I am a very begginer in PERL starting today in this mailing list! :-) I will try to work especially with Bioinformatics.

I am trying to verify the existence of a file in PERL; however, is seems not to work. It always returns "The file $file_seqs does not exist!!!".

Do you know where I am making a mistake?

<code>
#!/usr/bin/perl

use strict;

my $file_seqs;

$file_seqs = $ARGV[0];

        if (!-e $file_seqs)     {
        print "The file $file_seqs does not exist!!! \n";
        exit(0);
        }
        else    {
        print "The file $file_seqs exist!!! \n";
        }
</code>

Hi Renato,

Welcome to Perl.

Your code looks fine and it works for me.
Try entering the full path to the file you are checking for.


You could reduce

my $file_seqs;
$file_seqs = $ARGV[0];

to just

my $file_seqs = $ARGV[0];


Mike Flannigan


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to