in reply to The right way to avoid an error
inserts a backslash before the period in $mp3. But since $mp3 appears on the left side of a regexp that backslash will be a literal one. If $ARGV[0] includes a backslash, then inside the right-side of a regexp that backslash is a special character which merely turns the next character, but not the backslash itself, into a literal.$mp3 =~ s/\./\\\./g;
Thus,
will always fail because anyfilename.mp3 will never appear in anyfilename\.mp3if ($mp3 =~ /$ARGV[0]/i){
Adding that backslash to $mp3 breaks the program.
|
|---|