--- Francis Henry <[EMAIL PROTECTED]> wrote:
> Craig,
> 
> I'm a newbie too, but isn't the function "chomp"?

chomp is the one Craig seems to need, but there's also a chop.
chop() alsways knock a character off; chomp only pops input record
seperators (like newline, or CRLF, depending on what the value of $/
is).

perldoc -f chop
perldoc -f chomp

> Francis
> 
> Craig Moynes/Markham/IBM wrote:
> 
> > 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]
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to