in reply to The right way to avoid an error
Or, even better (not perl, and uses filesystem instead):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); } }
have fun.find . -type f -iname '*.mp3' | grep "pattern here" | xargs mpg123 -p +none -b 500 -q
|
|---|