note
Random_Walk
<p>of course once we get into checking the returns, we may find <c>chdir</c> does all the testing we need already ...
</p>
<code>
use strict;
use warnings;
use Cwd;
my $dir = shift;
chdir $dir or die "Couldn't chdir $dir: $!\n";
print "OK, in ". getcwd . "\n";
</code>
<p>And the outut</p>
<c>
# ./change.pl Downloads/
OK, in /home/Random/Downloads
# ./perl change.pl foo
Couldn't chdir foo: No such file or directory
# ./mkdir bar
# ./chmod 000 bar
# ./perl change.pl bar
Couldn't chdir bar: Permission denied
</c>
<p>Cheers,<br>R.</p>
<div class="pmsig"><div class="pmsig-382261">
Pereant, qui ante nos nostra dixerunt!
</div></div>
1199939
1199966