in reply to The right way to avoid an error

More terser (and check out HTML::LinkExtor, too):

use URI::Escape; # or CGI.pm has an escape() function # also at the top of the script. my $pattern = quotemeta( lc( $ARGV[0] ) ); # in your loop if (my ($mp3) = /^<a href="([^"]+)/) { # $mp3 should now hold a URL if ($mp3 =~ /$pattern/i) { $mp3 = uri_escape($mp3); `mpg123 -p none -b 500 -q $mp3`; } }

Update ChemBoy caught an error (didn't assign to $mp3 in a list context! Check those parens, kids!)

HTH!

perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'