troubleshooting Question

perl development question

Avatar of saibsk
saibsk asked on
Perl
6 Comments1 Solution270 ViewsLast Modified:
I have to find all the .dat files in the D:/data directory. And then open the file and read the customer name from the file.

Then I need to insert the file name and the corresponding customer name in the database.

eg. I need to find the file  "customer002.dat". Then I need to open this file and read the customer name (e.g John) and insert the file name "customer002.dat" and the name "john" into the database.

//This works only for hard coded file name:

      #!C:\Perl\bin\perl

      use File::Find;

      $dir = "D:/data";


      find(\&edits,$dir);

      sub edits() {
            return unless $_ eq 'customer002.dat';
            print "File name is $_\n\t\t full path is $File::Find::name\n";
      
}

Please advise.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros