Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^2: quston n File::Find

by skyworld_chen (Acolyte)
on Oct 30, 2012 at 12:09 UTC ( #1001492=note: print w/replies, xml ) Need Help??

in reply to Re: quston n File::Find
in thread question n File::Find

thanks for your kind reply.

a) in fact I insert"use warnings" and "use strict" in my code. I just omitted them for simple demo of my code. And in my real code I didn't miss quote, it is a type error here. Any way, thanks for your kind remind.

b) accroding to your ideas,I use

open $temp_file_cy, "$File::Find::name"

it is interesting that I haven't see "open $filehandle ...", but always "open filehandle ...". in the text book. Can you tell me the difference between them? thanks.

c) I have checked the attributes of those files, they are all -rw-rw----, so I guess "-r " should be ok here. In fact what I want to do really is this:

 my @matching = grep {/$pattern/} <temp_file_cy>;  

I always get this message: " readline() on unopened filehandle temp_file_cy at ../cy_find line 99", which make me to insert code "-r temp_file_cy" to see what happened

can you give me some help on this? thanks

Replies are listed 'Best First'.
Re^3: quston n File::Find
by aitap (Curate) on Oct 30, 2012 at 17:02 UTC
    Maybe there was an error in opening the file. Try autodie or check for errors like this:
    unless (open my $filehandle,"<",$File::Find::name) { warn $!; return; }
    Sorry if my advice was wrong.


      thank your for your advice. I used your advice in my code and this time the error message is as this:

      "No such file or directory at ......."

      I'm sure there are those files and I checked the log to find all "No such file" are files under sub-directory. I guess this maybe a "problem" of File::Find? or maybe I used something wrong in my code? thanks.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001492]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2018-02-19 15:07 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (266 votes). Check out past polls.