Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Searching a whole directory of databases

by pjf (Curate)
on Jun 24, 2002 at 03:01 UTC ( #176674=note: print w/ replies, xml ) Need Help??

in reply to Searching a whole directory of databases

You might find the following skeleton useful. This assumes you're already in the searchdbs folder.
foreach my $file (<*.txt>) { open(FILE,"< $file") or die "Cannot open $file - $!\n"; # Read in from FILE and do stuff with it... }
Of course, There's More Than One Way To Do It. You might find it easier dropping all the filenames in @ARGV and then using Perl's magic diamond operator:
@ARGV = <*.txt>; while (<>) { # Files will now be opened and read automagically, and # each line placed in $_. You can see which file # you're currently reading from by looking at $ARGV. }
Understanding how the above works is left as an exercise for the reader. ;)

All the best,
Paul Fenwick
Perl Training Australia

Comment on Re: Searching a whole directory of databases
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2016-05-03 01:45 GMT
Find Nodes?
    Voting Booth?