http://qs321.pair.com?node_id=147191


in reply to How do I get the directory containing a given file?

use Cwd qw(abs_path); use File::Basename; my $dir = dirname(abs_path($file));

Turning this into a complete perl program is left as an exercise to the reader.