in reply to HTML::Parser fun

This is completely unrelated to your problem, but I thought that I'd offer a style point. Your split's could be replaced by the simpler qw. For example, this:
$html_parser->report_tags( split '\s+', 'a area meta' );

could also be coded as:

$html_parser->report_tags( qw(a area meta) );

Replies are listed 'Best First'.
Re^2: HTML::Parser fun
by FreakyGreenLeaky (Sexton) on Jun 04, 2008 at 14:13 UTC
    Cool! I should remember that. My experience with perl is somewhat lacking.

    Speaking of which, what's up with the propensity of perl gurus to use qq{} and q{} so much when plain old '' or "" would do?

      I can't speak for others, but here are a couple of the benefits I see.

      • Less escaping necessary. q{brace {fun}} does what I want. I can say q{"quote" 'fun'} too. You do need to escape braces in a q{} if they're unbalanced, but otherwise it just works.
      • It stands out a little more for small expressions (q{} vs '').
      • Even if I don't have to escape anything now, I might have to later. If I code with q{} today, it saves me having to change to it later.
      • Likewise, it's easier to go from q{} to qq{} than it is to go from '' to "" if my interpolation behavior needs to change.
        OK - I understand. Something akin to the philosophy of always including a dangling comma in a list declaration - easy to add elements later without error, etc.
      ...what's up with the propensity of perl gurus to use qq{} and q{} so much when plain old '' or "" would do?

      I think it's mainly a scaling thing – unless your list contains only one or two items, qq{} will save your fingers a bunch of trips to the [Shift] and ['] keys. Sorry, misread the question in my haste. Please disregard.

Re^2: HTML::Parser fun
by FreakyGreenLeaky (Sexton) on Jun 17, 2008 at 15:53 UTC
    I just recalled: the split is a leftover from the origional code which reads something like:
    # this is actually read in from a conf file $conf{tags} = 'a area meta';
    with subsequent use as:
    $html_parser->report_tags( split '\s+', $conf{tags});
    qw// doesn't allow variable interpolation, is there an alternative syntax to using split to get the list?
      $conf{tags} = [ qw'a area meta ' ]; ...report_tags( @{ $conf{tags} } );