File opening problem
  Home FAQ Contact Sign in
perl.beginners only
 
Advanced search
POPULAR GROUPS

more...

perl.beginners Profile…
 Up
File opening problem         


Author: Tatiana Lloret Iglesias
Date: May 12, 2008 06:05

Hi all!

i'm running the following dummy program which just opens a file and I get an
error (die message)

#!/usr/bin/perl

if ( @ARGV[0] eq '' )
{
print "\nUSAGE:\n\t genenames.pl genes.txt \n\n";
exit;
}

my $file = $ARGV[0];
open(FICH,"$file") or die "cannot open $file";

I've tried to pass the input parameter ARGV[0] with / with \ with relative
path ... but nothing

any idea?

Thanks a lot!
T
2 Comments
Re: File opening problem         


Author: Chas. Owens
Date: May 12, 2008 06:10

On May 12, 2008, at 09:05, Tatiana Lloret Iglesias wrote:
Show full article (1.07Kb)
no comments
Re: File opening problem         


Author: John W. Krahn
Date: May 12, 2008 11:31

Tatiana Lloret Iglesias wrote:
> Hi all!

Hello,
> i'm running the following dummy program which just opens a file and I get an
> error (die message)
>
> #!/usr/bin/perl
>
>
> if ( @ARGV[0] eq '' )

@ARGV[0] is an array slice (a list) and it makes no sense to compare a
list to a string. It looks like you want something like this:

if ( @ARGV != 1 ) # must have 1 argument

Where you compare an array in scalar context which returns the number of
elements in that array.
Show full article (1.22Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
flash is slow and cannot open previous filesmacromedia.flash ·