"R. Joseph Newton" wrote:
> 
> "Leaw, Chern Jian" wrote:
> >
> > $currDir = `pwd`;
> > chomp($currDir);
> 
> Don't use chomp here.  The chomp function is for situations where
> you may not know whether a line is terminated by a newline.  You
> just assigned a value to pwd, so it is pointless to then chomp it.

The output from running a command in backticks will have newlines although
in scalar context it could have more then just one at the end.

$ perl -le'$x = `pwd`; print $x =~ tr/\n//; $x = `ls -l`; print $x =~ tr/\n//;'
1
236



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to