#!/usr/bin/perl use strict; my %ls = map { chomp; $_ => 2 } qx{/bin/ls -1}; opendir(DIR,".") or die "cannot readdir here - $!"; $ls{$_}++ foreach readdir(DIR); my @where = ("","readir only", "ls only", "both"); foreach (sort keys %ls) { printf("%12s: %s\n", $where[ $ls{$_} ], $_); } __END__ readir only: . readir only: .. both: file1.pl both: file2.pl both: path