#!/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; }