mobiGeek has asked for the wisdom of the Perl Monks concerning the following question:

Seems simple enough, but what is the best platform-independent way to get the directory for a given file path?

I want a simple program that is given a list of files (say, output from "find") and for each file, prints the containing directory.

For example:

  $ pwd
  $ perl  ../foo.html /etc/passwd /a/b/c/smile.gif
Thanks in advance,