in reply to The right way to avoid an error

Why not:
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!<a href=["']([^"']+)!i) { my $mp3 = $1; system('mpg123', "-p none -b 500 -q $mp3") if($mp3 =~ m!$ARGV[0]!i); } }
Or, even better (not perl, and uses filesystem instead):
find . -type f -iname '*.mp3' | grep "pattern here" | xargs mpg123 -p +none -b 500 -q
have fun.