Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    
    ...
      perl tricky_html_filter.pl foo.html
    
    =cut
    
  2. or download this
    my $file = shift || 'E:/path/to/dummy1.html';
    open INFILE, '<', $file, or die "$!: can't open $file\n";
    
  3. or download this
    while (<INFILE>) {
        s/(background-color:#)(?:[0-9a-f]{6}|[0-9a-f]{3})/$1ffffff/i;
        print;
    }
    
  4. or download this
    while (<INFILE>) {
        print;
    }
    
  5. or download this
    while ($_ = <INFILE>} {
        print $_;
    }
    
  6. or download this
    while (my $line = <INFILE>} {
        print $line;
    }
    
  7. or download this
    s/(background-color:#)(?:[0-9a-f]{6}|[0-9a-f]{3})/$1ffffff/i;
    
  8. or download this
    $1ffffff
    
  9. or download this
    #!/usr/bin/perl
    
    ...
        s/(background-color:#)(?:[0-9a-f]{6}|[0-9a-f]{3})/$1ffffff/i;
        print;
    }
    
  10. or download this
    perl -pi -e"s/(background-color:#)(?:[0-9a-f]{6}|[0-9a-f]{3})/$1ffffff
    +/i" /path/to/dummy1.html
    
    # be sure and replace " with ' if you run this on *NIX