1834090 Members
2044 Online
110063 Solutions
New Discussion

error

 
rgoud
Occasional Advisor

error

Paddy,

I am not sure what is missing, it is giving error when I run it.
#!/usr/bin/perl -w
use File::Find;

open F,"my $size = (lstat(F))[7];
print $size;
$ ./test29.pl
lstat() on filehandle F at ./test29.pl line 4.

4 REPLIES 4
Eugeny Brychkov
Honored Contributor

Re: error

I guess F is a file handle and is a variable, so should be $F
Eugeny
John Poff
Honored Contributor

Re: error

Hi,

I cut and pasted your script onto my test box, created a small /tmp/file1.lck file for it to use, and I was able to run your script just fine. My box has Perl 5.6.0 on it. What version of Perl are you running? Also, what kind of file is /tmp/file1.lck?

JP
S.K. Chan
Honored Contributor

Re: error

Run it in debug mode and see what it says ..
$ perl -d test29.pl
In the prompt enter "n" (ie for next) to process the code line by line.
Bill Douglass
Esteemed Contributor

Re: error

It looks like a bug in either the version or specific build of perl.

One one host, I get the following:

qe2n1:/home/bdouglas> perl -w test.pl
0
qe2n1:/home/bdouglas> perl -v

This is perl, v5.6.1 built for PA-RISC1.1-thread-multi
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2001, Larry Wall

Binary build 633 provided by ActiveState Corp. http://www.ActiveState.com
Built 21:04:57 Jun 17 2002



On another machine:

qe2l1:/home/bdouglas> perl -w test.pl
lstat() on filehandle F at test.pl line 5.
86
qe2l1:/home/bdouglas>
qe2l1:/home/bdouglas> perl -v

This is perl, v5.8.0 built for PA-RISC2.0