#!/usr/bin/perl -w # show filetype for each file. use strict; use subs qw/ftype/; if (@ARGV) { foreach (@ARGV) { ftype($_); } } else { while (<>) { chomp; ftype($_); } } exit(0); sub ftype { my ($file) = shift; print "f $_\n" if -f "$file"; print "d $_\n" if -d "$file"; }