in reply to Re: Re: Mangled print output -- any ideas why?
in thread Mangled print output -- any ideas why?

The problem you are seeing with chomp is that Perl uses the line terminator appropriate to the current platform, so if you're in UNIX, Perl chomps just the LF, which is the UNIX value of \n. If you had used the chomp in Win32 you would have removed CRLF, as that is the \n value for that platform. I presume (and welcome corrections) that if your phone data had come from a Mac, the UNIX chomp would not have removed anything, as for UNIX the lines would not appear to have terminators at all (and so the data would have been one long line). This is nicely described in perlport.

As to fixing it, while chomp appears to be a logical choice, it is an approach of "remove the bad" when you believe you know what the bad is, but as this case has shown you often can't be certain of what the bad is. It is probably safer to reverse this to an approach of "keep the good", with something like tr/0-9//cd, especially since your phone number field is so easy to specify.

--
I'd like to be able to assign to an luser