use strict; use IO::File; use constant INDEX_FILE => './index.html'; my $fh = IO::File->new(INDEX_FILE) or die INDEX_FILE, ":$!"; while(<$fh>) { if(m!## find . -type f -iname '*.mp3' | grep "pattern here" | xargs mpg123 -p none -b 500 -q