Thanks Ovid for this script that works great! Can you or someone please explain some of this script to me so I understand what it is doing?
use strict; use File::Find; use HTML::TokeParser; my $bak_ext = '.bak'; my $root_dir = '/temp'; find(\&wanted, $root_dir); sub wanted { # if the extension fits... if ( /\.html?/i ) { print "Processing $_\n"; my $new = $_; my $bak = $_ . $bak_ext; rename $_, $bak or die "Cannot rename $_ to $bak: $!"; open NEW, "> $new" or die "Cannot open $new for writing: $!"; + #WHAT IS THE + DOING? #I DONT UNDERSTAND THIS TOKEN PART my $p = HTML::TokeParser->new( $bak ); #IS new( $bak ) A FUNCTION AND IF SO WHAT IS IT DOING? while ( my $token = $p->get_token ) { # this index is the 'raw text' of the token #I AM LOST ON THIS PART ALTHOUGH I UNDERSTAND IT IS AN IF ELSE STATEMENT WHAT IS THE 'T' AND 1 AND -1 DOING?? my $text_index = $token->[0] eq 'T' ? 1 : -1; # it's both a start tag and a meta tag #PLEASE EXPLAIN THIS PART if ( $token->[0] eq 'S' and $token->[1] eq 'meta' ) { $token->[ $text_index ] =~ s/AA\.//g; } #I DONT UNDERSTAND THIS PART. print NEW $token->[ $text_index ]; } close NEW; } else { print "Skipping $_\n"; } }
Are the point symbols -> taking an object and kicking off a function??

In reply to Script (ovid's) explanation by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.