#! /usr/bin/perl # Assignment 9, check and read files and directories use strict; use warnings; use Module1; assnintro(); while (1) { print "Enter one file or directory name: "; my @params = split /\s+/, <>; if (@params != 1) { print color 'red'; print "One directory or file entry expected.\n"; print color 'reset'; next; } my $input = $params[0]; if (!-e $input) { print color 'red'; print "The file or directory '$input' doesn't exist.\n"; print color 'reset'; } elsif (-d $input) { last if !doDir($input); } else { last if !doFile($input); } } sub doDir { my ($input) = @_; print "'$input' is a directory.\n"; my @subDirs = glob $input; return if !@subDirs; #... return 1; } sub doFile { my ($input) = @_; print "'$input' is a file.\n"; #... return 1; }