http://www.perlmonks.org?node_id=1021021


in reply to Re: Using File::Find
in thread Using File::Find

Thank you for the reply. I tried this:

#!/usr/bin/perl -w use strict; use warnings; use File::Find; use Cwd; my $dir = getcwd; my %hashTS; find(&wantedTS, "$dir"); sub wantedTS() { if ($File::Find::name =~ /(.*)(\.ts)(\.txt)$/) { $hashTS{$File::Find::name}++; } }

to place text files ending with .ts.txt into my hash, but it doesn't work because "Use of uninitialized value $File::Find::name"

Replies are listed 'Best First'.
Re^3: Using File::Find
by tobyink (Canon) on Feb 28, 2013 at 09:28 UTC

    You're missing a backslash...

    find(\&wantedTS, "$dir");
    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name