programming-examples/perl/File/Change a directory.pl
2019-11-15 12:59:38 +01:00

12 lines
301 B
Perl

#!/usr/bin/perl -w
use strict;
print "please enter a directory name: ";
chomp(my $dir = <STDIN>);
mkdir $dir, 0777 or die "failed to make directory $dir: $!\n";
print "made the directory $dir ok!\n";
chdir $dir or die "failed to change into $dir: $!\n";
print "changed into $dir ok!\n";