in reply to verifying user input with Find::File

It may help to copy and paste your teacher's actual instructions. Items 1 & 2 aren't altogether clear, especially instructions of the form exit when the file is an empty file, and print the last line of the file - an empty file doesn't have a last line. Have you "reinterpreted" the actual instructions for us?

You don't show us the code you've tried that uses File::Find.

Did your teacher specify that you need to search "everywhere" for the file (that's a pretty big ask depending on how you choose to interpret "everywhere"). If not, just assume the current directory and ignore File::Find.

There are many quirks in your code. Here's a cleaned up version of your code followed by some comments on the changes.

#! /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; }

Of note:

Perl is the programming world's equivalent of English