From: "David Blevins" <[EMAIL PROTECTED]>
> Background: I get automated emails that contain information about
> project tasks (this is a sourceforge project). As I am the project
> admin, I get all emails.
>
> Here is a shortened version of the program. I'm a terrible perl
> programmer, so any tips are welcome.
>
> my $status;
> my $assignedto;
>
> while (<STDIN>) {
> chomp; # Drop the newline
> if (/^Status:/) { s/.*: ([^ ]*)$/$1/; $status = $_; next;} if
> (/^Assigned to/) { s/.*: ([^ ]*)/$1/; $assignedto = $_; next;}
> }
>
> #The value of $status should be 'Open'
> #The value of $assignedto should be 'dblevins'
> print $status,"x\n";
> print $assignedto,"x\n";
> #I am expecting this output:
> #Open
> #dblevins
> #But for some reason, these two print statements print this:
> #xpen
> #xblevins
I think the problem is that the mail messages contain CRLF as the
line ending. But since you are either running the code under Unix
or you've binmoded the STDIN or something, the <STDIN> reads
the lines with CRLF and chomp() only strips the LF.
Thus what you are printing is
Open\rx\n
or
OpenCRxLF
Which then on the terminal will look as
xpen
Add a chop() after the chomp() and you should be OK.
Jenda
=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]