#!/usr/bin/perl use warnings; use strict; use Error qw/:try/; use File::Find; { package Exception::FoundFile; use base qw/Error/; sub new { my $s = bless {}, __PACKAGE__; $s->{_file} = shift; return $s; } sub file { return shift->{_file}; } } try { find(sub { my $file = $File::Find::name; # Show our working, so you can see we stop early print "Examining $file\n"; throw Exception::FoundFile->new($file) if ($file =~ /f/); # Or whatever your condition is }, "."); } catch Exception::FoundFile with { my $e = shift; print "Found file: ", $e->file, "\n"; } otherwise { print "Didn't find a file\n"; };