in reply to Opening text files with CR format

Unless I've misunderstood the question, I think that the solution offered by both moritz & linuxer have missed the point - AFAICT, the OP appears to be experiencing problems actually opening files c/w reading a successfully opened file.

Never having used a Mac (thus not being aware of the pitfalls), my only suggestion would be to change:

@files = <*.tx>;
to read:
@files = <*.tx>; chomp @files;
thus removing any trailing whitespace from the filename(s).

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: Opening text files with CR format
by knith (Initiate) on Aug 03, 2009 at 19:34 UTC
    Hi, sorry maybe I was not so clear with the question, I am using a normal computer with windows, the files that I am working with where stored by someone using a mac, that is why new line indicator is different and not recognized by the open function in perl. It took me a while to realized why it was not working properly. First I started programming with perl since a couple of hours and the second thing is that my text editor can handle mac, unix, dos terminations, giving no hint what kind of format for the new line was used. Thanks for the answer anyway :))