A little background. I am running an scp process within a perl script and
redirecting the error to a file (scp_err). I then read in the lines of
this file and attempt to place them in an error string to log to syslog.
Code Sample:
#!/usr/bin/perl -w
open ( ERR, "<scp_err" );
my ( $err_msg ) = "";
while ( !eof(ERR) )
{
my ( $in ) = "";
$in = <ERR>;
chop $in;
print "$in\n";
$err_msg = $err_msg . $in;
}
print "Message - $err_msg\n";
Now I have added a lot of extra print statements for debugging purposes.
Sample Output:
ssh: HOST: Host not found
lost connection
lost connectionHOST: Host not found
The first two lines being each line in the scp_err file, and the last line
being the final line.
If I remove the chop then it works fine (except for the newline char that I
want to remove). If I replace the chop with a s/\n$// then it gives the
same output.
Any ideas why this is occurring ?
-----------------------------------------
Craig Moynes
Internship Student
netCC Development
IBM Global Services, Canada
Tel: (905) 316-3486
[EMAIL PROTECTED]