Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nasty Newlines

Status
Not open for further replies.

Siberdude

Programmer
Apr 4, 2000
29
GB
Howdy all. I just moved from a IIS box to a unix one. i used to be able to deal with newlines with:

$mevar =~ /\n//gi;

but on the unix box this doesn't work! the \n char coems up as a square box and i can't for the life of me figure how to get rid of the bloody thing, so i can then use the flatfile dat db i was on the old box. it never makes a match now, because its seeing my read-in vars as "var\n" instead of "var". Much pain in the arse!

Thanks
Sib
Siberdude
siberdude@settlers.co.uk
 
Sounds like your files may be DOS formatted with a carriage return (\r) and a new line (\n). You will need to get rid of both. You can use the Perl 'chomp' function or match it with '\r\n'.


HTH



keep the rudder amid ship and beware the odd typo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top