#!/usr/bin/perl -w use strict; use File::Find; my @files=qw(. src); my $found; sub wanted { $found ||= $File::Find::name if $_ eq "xx.pl"; } find(\&wanted, @files); print "$found\n";