use strict; my $file = shift or die 'gimme a file!'; die 'no such file' unless -e $file; print "directory\n" if -d $file; print "plain file\n" if -f $file; print "sym link\n" if -l $file;