Re: Can't use string as a symbol ref

2007-12-17 Thread Chas. Owens
On Dec 17, 2007 10:19 AM, ciwei2103 <[EMAIL PROTECTED]> wrote: > Can somebody enlighten me what I'm doing wrong? > > I have a list in a file , "test.dat" > > sh> cat test1.dat > 0039 > 0038 > > sh> cat test1.pl > #!/usr/bin/perl -w > use strict; > my $input = $ARGV[0]; > > my @devices = <$input>

Re: Can't use string as a symbol ref

2007-12-17 Thread yitzle
Maybe tell us what you are trying to do? Try this: > #!/usr/bin/perl -w > use strict; > my $input = $ARGV[0]; # File handle my $FH; # Check the file is a normal file and exists die "File does not exist\n" if not -f $input; # Open the file handle for read only, file named by $input # Or die and

Re: Can't use string as a symbol ref

2007-12-17 Thread Tom Phoenix
On 12/17/07, ciwei2103 <[EMAIL PROTECTED]> wrote: > Can somebody enlighten me what I'm doing wrong? > my $input = $ARGV[0]; > > my @devices = <$input> ; $input is a string, since it comes from @ARGV; but you're using it as if it's a filehandle. Do you need open()? Hope this helps! --Tom Phoen