in reply to Parsing with HTML::TreeBuilder::LibXML on OpenSuse Linux 11.4 Milestone 1

Perlbeginner1:

I don't intend to be rude, but your post sounds to me like someone walking into someones home and exclaiming "Geez! What an ugly sofa! You should buy a new one!" All the while, you're wearing a burnt-orange shirt and a lime-green suit with purple socks.

I personally don't want all the glitter and beads on a website. I just want something that works well. And things are pretty nice, here, thanks.

Anyway, if each file contains one chunk of text you want, then I'd do something similar to:

use strict; use warnings; open OUF, '>', 'CollectedInfo.txt' or die; while (my $FName = shift) { print OUF doit($FName), "\n\n"; } close OUF; sub doit { my $text; if (! open INF, '<', $_[0]) { print "Can't open file '$_[0]', skipped!\n"; return ''; } # slurp in the entire file local $/; $text = <INF>; # Trim off everything before "Hit # of #" $text =~ s/^.*?Hit\s+\d+of\s\d+//; # Trim off everything after "listed since:" $text =~ s/listed since:.*$//; # Code for cleaning up the text goes here # (left as exercise for the reader) # Return desired chunk of text return $text; }

Note: untested, you can keep both pieces if (when) it breaks, etc.

...roboticus

  • Comment on OT: What a hideous sofa! (Re: Parsing with HTML::TreeBuilder::LibXML...)
  • Download Code

Replies are listed 'Best First'.
Re: OT: What a hideous sofa! (Re: Parsing with HTML::TreeBuilder::LibXML...)
by Erez (Priest) on Sep 26, 2010 at 07:59 UTC

    someone walking into someones home and exclaiming "Geez! What an ugly sofa! You should buy a new one!" All the while, you're wearing a burnt-orange shirt and a lime-green suit with purple socks.

    I don't care if you're wearing a 10,000$ Armani suit, you don't go into someone's house and start criticising his sofas. I can take criticism, but put the limit in sofas.

    "Principle of Least Astonishment: Any language that doesn’t occasionally surprise the novice will pay for it by continually surprising the expert..

      Sofa? Sofa! It's a settee if you don't mind!