Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Read first line from each file in a directory

by mr.nick (Chaplain)
on Dec 16, 2011 at 16:24 UTC ( #943963=note: print w/replies, xml ) Need Help??

in reply to Read first line from each file in a directory

Try testing if your opendir and open succeeded.

mr.nick ...

Replies are listed 'Best First'.
Re^2: Read first line from each file in a directory
by Anonymous Monk on Dec 16, 2011 at 16:28 UTC

    Already did, they work.

      I doubt that. As choroba stated, you are actually trying to open a file named $file.

      mr.nick ...

        I tried it without quotations, and it adds a new warning: "readline() on closed filehandle WRITE"

        and I did check opendir and readdir, they both work. Also, I'm not working in the root folder by accident

      And your opendir will only work (by accident) if you are in the root folder when you start the script.

      Enjoy, Have FUN! H.Merijn

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2018-06-25 12:41 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.