print "Enter a directory´s path to work with all files in a folder or a single file path\n\n"; chomp(my $input = ); if (-f $input){ # $input is the name of an existing file ... process file }elsif (-d $input){ # $input is the name of an existing folder ... process folder }