Hi Renato, people here helped you but here are a few comments.
On Wed, 25 Sep 2013 16:38:22 -0300 RENATO AUGUSTO CORREA DOS SANTOS <rcs.un...@ig.com.br> 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!!!". > With respect to calling Perl "PERL" see: * http://perl-begin.org/learn/Perl-perl-but-not-PERL/ (Note: I maintain perl-begin.org ). > Do you know where I am making a mistake? > > <code> > #!/usr/bin/perl > > use strict; > You also want "use warnings;": http://perl-begin.org/tutorials/bad-elements/#no-strict-and-warnings > my $file_seqs; > > $file_seqs = $ARGV[0]; It is a good idea to not declare and assign in separate statements, just do «my $file_seqs = ...». Furthermore, it's inadvisable to use $ARGV[0] - see http://perl-begin.org/tutorials/bad-elements/#subroutine-arguments . > > if (!-e $file_seqs) { > print "The file $file_seqs does not exist!!! \n"; > exit(0); > } > else { > print "The file $file_seqs exist!!! \n"; > } Your indentation here is wrong. The if/else/} should not be shifted while the contents inside the block should be. See: https://en.wikipedia.org/wiki/Indent_style Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Selina Mandrake - The Slayer (Buffy parody) - http://shlom.in/selina Bugs are too afraid to reproduce on Chuck Norris’ computer. As a result, when he uses Microsoft Windows, it behaves just like a Linux system. — http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/ Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/