On Fri, Mar 7, 2008 at 2:00 AM, Angus Glanville <[EMAIL PROTECTED]> wrote: snip > It seems like the all the > contents of the file index are run against one iteration of the > directory contents then it quits. snip > opendir (PDFDIR, $pdf_dir) || die "Can't open $pdf_dir: $!\n"; > > while (my $line = <INDEX> ) { > chomp $line; > my ($raw_name, $std_name) = (split /\|/, $line); > if (grep {$std_name} readdir(PDFDIR)) { > print "I found this: $std_name\n"; > } > } snip
You are opening the PDFDIR directory handle outside of the while loop. You are then consuming all of the entries with the grep. You either need to move the opendir to inside the while loop or add a call to rewinddir*. * see perldoc -f rewinddir or http://perldoc.perl.org/functions/rewinddir.html -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/