#!/usr/bin/perl use strict; use warnings; =head1 DESCRIPTION tricky_html_filter.pl - filters the stuff i want - changes background-color to #fff - =head2 USAGE perl tricky_html_filter.pl foo.html =cut #### my $file = shift || 'E:/path/to/dummy1.html'; open INFILE, '<', $file, or die "$!: can't open $file\n"; #### while () { s/(background-color:#)(?:[0-9a-f]{6}|[0-9a-f]{3})/$1ffffff/i; print; } #### while () { print; } #### while ($_ = } { print $_; } #### while (my $line = } { print $line; } #### s/(background-color:#)(?:[0-9a-f]{6}|[0-9a-f]{3})/$1ffffff/i; #### $1ffffff #### #!/usr/bin/perl use strict; use warnings; =head1 DESCRIPTION tricky_html_filter.pl - filters the stuff i want - changes background-color to #fff - =cut my $10ffffff; my $file = shift || 'foo.html'; open INFILE, '<', $file, or die "$!: can't open $file\n"; while () { s/(background-color:#)(?:[0-9a-f]{6}|[0-9a-f]{3})/$1ffffff/i; print; } #### 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