WC -Sx- Jones wrote:
> MuthuKumar wrote:
> > print "Enter a path name: ";
> > my $path=<STDIN>;
> > chdir($path);
> 
> 
> chdir never "stays" in the directory...

Huh? Sure it does.

> 
> Proof:
> 
> print "Enter a path name: ";
> my $path=<STDIN>;
> chdir($path);
> print `pwd`;

That doesn't prove anything. The chdir fails because the input needs to be
chomp'ed. Neither the OP nor you is checking the return value from chdir().

Try:

   chomp(my $path = <STDIN>);
   chdir $path or die $!;
   print `pwd`;

-- 
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