Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Opening text files with CR format

by Bloodnok (Vicar)
on Aug 03, 2009 at 12:30 UTC ( [id://785442]=note: print w/replies, xml ) Need Help??


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 :))

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://785442]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-19 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found