![]() |
|
The stupid question is the question not asked | |
PerlMonks |
Re: Need help with a simple perl scriptby kcott (Archbishop) |
on May 23, 2012 at 17:30 UTC ( #972072=note: print w/replies, xml ) | Need Help?? |
Like others, I cannot reproduce your error with the code you've posted. Using Perl 5.14.2 and Mac OS X 10.7.4, I get:
You asked "How do I get the count value to not print to a new line?". However, that's not really what's happening. Taking the first line of what you're getting, this actually looks like:
The last pipe character comes from $"="|";; the 4 is your count value; the terminal <newline> is the \n from the print statement. The bogus <some-return-char> comes from the while loop's $_ value. I can reproduce your output by adding my own bogus return character:
which now outputs:
You'll need to determine where the bogus return is added: it could be when the file is initially populated or perhaps due to some subsequent processing it undergoes before you read it. I've encountered this problem in the past when data is copied and pasted from an email, when data is transferred via FTP in binary mode and similar scenarios involving systems using different line endings. I would suggest the following as your options:
-- Ken
In Section
Seekers of Perl Wisdom
|
|