Had correspondence from a user of File::Find::Rule who wanted to dothe slightly fun "all directories which contain files called *.jpg". Went a bit small-tools crazy as this is what I came up with:
use strict; use File::Find::Rule; use File::Basename qw(dirname); my @dirs = keys %{ { map { dirname( $_ ) => 1 } find( file => name => '*.jpg', in => '.' ) } };
Tell a lie. The code I sent was much less golfier, since even with small tool mania I felt compelled to be clear, but I still enjoyed combining two modules to get the desired effect rather than needing any more code.