Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Help with exercise

by Random_Walk (Prior)
on Sep 24, 2017 at 07:40 UTC ( #1199980=note: print w/replies, xml ) Need Help??


in reply to Re^2: Help with exercise
in thread Help with exercise

of course once we get into checking the returns, we may find chdir does all the testing we need already ...

use strict; use warnings; use Cwd; my $dir = shift; chdir $dir or die "Couldn't chdir $dir: $!\n"; print "OK, in ". getcwd . "\n";

And the outut

# ./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

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1199980]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2021-04-11 19:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?