sub fn1 { my ($fh, $ucsearch ) = @_; my $count = 0; while (my $record = <$fh>) { next unless uc($record) =~ /$ucsearch/; print $record; $count++; } return $count; } ## data is a reference to an array of hashes data structure containing ## the full file name, the file basename, title, and something that helps decide what you are going to print if the file doesn't open. ## setdata is a subroutine which creates and fills the data structure, then returns a reference to it ## hint: look the core module File::Basename (http://perldoc.perl.org/File/Basename.html) to extract the file basename my $data=setdata(); foreach my $datum (@$data) ( if (open(my $fh, $prestring.$data->{'filename'}) { print "
