i need help using File::Find::name

Discussion in 'Perl' started by harkki, Dec 3, 2008.

  1. harkki

    harkki New Member

    Joined:
    Apr 26, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi

    i'm very new at perl. i have tried to create a script that reads information(filenames) from txt file and then tries to find if there are matching filenames in certain directoyry and print them out. oh and it has to print the filenames out with their paths. So i have thinking to use this "File::Find::name" that perl has.

    I have started it with something like this:

    use File::stat;
    use File::Find;

    find(\&wantedfiles, "/a"); # Get list of all changed files

    sub wantedfiles{

    $file = "/srcfiles.txt"; # path to the txt where filenames are
    open(INPUTFILE, $file); # Open the file
    @lines = <INPUTFILE>; # Read it into an array
    close(INPUTFILE);

    foreach $file (@lines) {
    print "$File::Find::name \n" if "$_" eq "$file";
    }

    }



    if some one could give me some pointers or something to work with, i would preciate it very much.

    Br,
    H.P
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    48
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    What problem are you facing with your script?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice