http://www.perlmonks.org?node_id=118701

sheridan3003 has asked for the wisdom of the Perl Monks concerning the following question:

I have written a small piece of code to cleanup the html code I have in a directory. I was wondering how this code could be improved.
#!/usr/bin/perl -w use HTML::Clean; my @file_list = `ls *.html`; foreach(@file_list) { chomp(); clean_file($_); } sub clean_file { my ($filename) = shift; print "$filename is being cleaned!\n"; my $h = new HTML::Clean($filename,9); $h->compat(); $h->strip(); my $myref = $h->data(); open(OUTPUT,">$filename"); print OUTPUT $$myref; close(OUTPUT); }
I would like to improve my coding abilities and seek the wisdom of others to guide me. Thanks.