Wait, I got it, but it's something worth putting into an FAQ or something.

I added the lines:
    $status += "";
    $assignedto += "";

And got the output:

Argument "" isn't numeric in addition (+) at ./task_notification.pl line 46,
<STDIN> line 20.
Argument "Open\r" isn't numeric in addition (+) at ./task_notification.pl
line 46, <STDIN> line 20.
Argument "" isn't numeric in addition (+) at ./task_notification.pl line 47,
<STDIN> line 20.
Argument "dblevins\r" isn't numeric in addition (+) at
../task_notification.pl line 47, <STDIN> line

What's that carriage return doing there, it should have been chomped!  The
problem is that I am using the cygwin perl port, the chomp is only taking
the "\n" and not "\r\n".  When I switch my perl interpreter to the
ActiveState one, the problem goes away.

Would you consider this a bug in the cygwin port or desired behavior?

David

> -----Original Message-----
> From: David Blevins [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 29, 2002 6:17 PM
> To: [EMAIL PROTECTED]
> Subject: Strange scalar behavior
>
>
> Hi All,
>
> You'll have to bare with me on this one as I can post code to repeat the
> problem.  I hope I can give enough details so that the cause of the
> "problem" is clear.
>
> 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.
>
> My Goal: Automatically send a reformatted version to our
> developer list with
> a little help from procmail and perl.
>
> My Problem: The values I parse from the email (coming from STDIN) are not
> acting like a "normal" string scalar.
>
> 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
>
>     #To give it another try
>     print "<$status>";
>     print "<$assignedto>";
>     #Again, I expect this:
>     #<Open><dblevins>
>     #But even stranger than before, I get this:
>     #><dblevins
>
> Could anyone give me clue, I am clearly missing something basic!
>
> Many thanks!
> David
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to