Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Using File::Find

by Dr Manhattan (Beadle)
on Feb 28, 2013 at 08:54 UTC ( #1021021=note: print w/ replies, xml ) Need Help??


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"


Comment on Re^2: Using File::Find
Download Code
Replies are listed 'Best First'.
Re^3: Using File::Find
by tobyink (Abbot) 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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021021]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2015-07-30 10:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls