Quote?the module chugs away constructing the entire list of files first, before you can then work with them
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/usr/bin/env perl use warnings; use strict; use 5.10.1; use File::Find; my $dir = '/var'; my $databases; find( { wanted => sub { my $file = $File::Find::name; return if not -f $file; return if not -s $file; return if not -r $file; open my $fh, '<', $file or die $!; my $firstline = readline( $fh ); close $fh or die $!; push @$databases, $file if $firstline =~ /\ASQLite/; }, no_chdir => 1, }, $dir ); say scalar @$databases;