Perl Help For Newbie

mark rowlands mark.rowlands at
Tue Apr 27 10:48:34 PDT 2004

> -----Original Message-----
> From: owner-freebsd-questions at 
> [mailto:owner-freebsd-questions at] On Behalf Of 
> Christopher Nehren
> Sent: Tuesday, April 27, 2004 2:53 AM
> To: FreeBSD Questions List
> Subject: Re: Perl Help For Newbie
> Can someone explain to me why people are suggesting to parse 
> markup languages manually? There's modules -- dozens -- for 
> this. Use CPAN.

because he is a perl beginner and doesn't know about cpan and modules
and stuff......

how about being a bit more specific :-

try :-

cd /usr/ports/www/p5-HTML-parser && make install clean

perldoc HTML::Parser (see the examples sections) or as a 

use HTML::TokeParser::Simple;
  $p = HTML::TokeParser->new(shift||"index.html");

  while (my $token = $p->get_tag("a")) {
      my $url = $token->[1]{href} || "-";
      my $text = $p->get_trimmed_text("/a");
      print "$url\t$text\n";

(HTML::TokeParser::Simple  is not in the ports tree yet but 
will be once the current port freeze is over but

perl -MCPAN -e shell   
cpan> install HTML::TokeParser::Simple
Running install for module HTML::TokeParser::

will perform the necessary magic :- 

More information about the freebsd-questions mailing list