use strict; use warnings; use Cwd; use Getopt::Long; use File::Spec; # this will automatically load OS-appropriate functions # ... [snip] ... # Get the current working directory my $home_dir = getcwd; # Change to the test directory chdir($testdir) or die "$0: chdir $testdir: $!"; # Set up test dirs if they do not exist for my $t ( qw/test test1/ ) { mkdir $t or die "mkdir ". File::Spec->catfile($testdir, $t) .": $!\n"; } # Change to the test area chdir("test") or die "chdir test: $!\n"; # Directory Manipulation for my $dir ( 0 .. $num-1 ) { my $dirname = "directory$dir"; # Make the directory if (!-d $dirname ) { mkdir $dirname or die "mkdir ". File::Spec->catfile( $testdir, "test", $dirname ) .": $!\n"; } #...