in reply to Tutorial on File::Find even more basic than "Beginners Guide"

How are we supposed to help if you don't show the script, or tell us what it's supposed to do? What would "finding all HTML links" accomplish?

Please show some code and tell us what it does and what it should do.

  • Comment on Re: Tutorial on File::Find even more basic than "Beginners Guide"

Replies are listed 'Best First'.
Re^2: Tutorial on File::Find even more basic than "Beginners Guide"
by ww (Archbishop) on Jan 20, 2005 at 23:06 UTC
    I think you may have missed the last graf: I am NOT seeking a solution; I'm seeking a reference to a tutorial on File::Find better suited to my level of understanding of perl than I have so far located.

    As to the point of finding all .html links (such as <a href="foo.bar...., <a name="foo style="xxxx" href=".... and so on, I invite your attention to the para referring to management's directive to remove links to a wide variety of sites (which were previously "approved.")

    however, in all fairness, I don't like to see homework or no-work posted either. Update (23 Jan 05): Working code may be found in the grandparent, Tutorial on File::Find even more basic than "Beginners Guide".

      Ok, well, File::Find is not that hard:
      use File::Find; use strict; sub process_file { return unless -f _; # skip processing unless $_ is really a file (no +t a dir) # some code that # does stuff with $_ (contains the "current file") } # call &process_file recursively for each file in /some/directory find \&process_file, "/some/directory";
      The rest of File::Find is just "specifics" that you don't need for the problem you're trying to solve.

      update: Try using HTML::LinkExtor - something like

      use HTML::LinkExtor; my $p = HTML::LinkExtor->new(); sub process_file { return unless /\.html?$/i; # skip unless *.htm / *.html file return unless -f _; # skip processing unless $_ is really a file (no +t a dir) $p->parse_file($_); print $p->links; }
        Joost:

        and another "thank you" goes up, irritating those who regard such as space wasters.

        so I guess I'll also have to seek one additional clarification: in line 11, re file::find, you write:

        find \&process_file, "/some/directory";

        As I understand this (and I think much more clearly, thank you!) I really need to specify all the subdirs, perhaps by stuffing them into an array and feeding each element to the sub?