in reply to Re^2: globing directory names with spaces
in thread globing directory names with spaces

Hello All,
thanks you so much for all the replies
Here is what i wrote with File::Find
#!/usr/bin/perl use strict; use warnings; use File::Find; my @java_files; my $pattern = shift; if ($pattern eq '') { print "defaulting the directory to the current one\n"; $pattern = '.'; } print "$pattern\n"; find(\&wanted, $pattern); foreach my $file (@java_files) { open OUTFILE, "$file"; while(<OUTFILE>) { print "$_\n"; } } my $java_files = @java_files; print "++ Total number of java files in project = $java_files\n"; sub wanted() { if (/\.java$/i) { push(@java_files, $_); } }
The problem is that the contents of the files are not
getting printed. because the file open is failing.
the file open is failing because I have only the file name
and not the complete path of the file. what can I do go get
the complete file name in my java_file array?

Replies are listed 'Best First'.
Re^4: globing directory names with spaces
by Aristotle (Chancellor) on Sep 16, 2002 at 16:49 UTC
    Did you read my reply? You would have noticed I was using $File::Find::name rather than $_ in the sub I pass to find because I anticipated just that problem. :-) See the docs to File::Find for more details.

    Makeshifts last the longest.