Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: problems with reading data from cfg file

by pitbull3000 (Beadle)
on Sep 10, 2001 at 02:45 UTC ( #111347=note: print w/replies, xml ) Need Help??


in reply to problems with reading data from cfg file

i think i figured it out why i always get an error. the config file is written on a win32 box, and as i was told right now there is more than just \n at the end of the line, there is also a \r there, so i have to get rid of this also...
  • Comment on Re: problems with reading data from cfg file

Replies are listed 'Best First'.
Re: Re: problems with reading data from cfg file
by Jazz (Curate) on Sep 10, 2001 at 08:03 UTC
    chomp will remove only the newlines based on the current value of $\ which is the OUTPUT_RECORD_SEPARATOR (in English)

    If the file was written on win32 (where $\ defaults to \n\r) and then uploaded to unix (where $\ defaults to \n), chomp only catches the \n and misses the \r.

    So you can do this:

    foreach ( @config_pairs ) { chomp; s/\r//; # more stuff }

    Jasmine

      yep, thanks jazz. already put some nice regex into my loop, and now it just works fine.... ;.D

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2022-12-10 08:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?