There appears to be an error in your code.
$mp3 =~ s/\./\\\./g;
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.
Thus,
if ($mp3 =~ /$ARGV[0]/i){
will always fail because
anyfilename.mp3 will never appear in
anyfilename\.mp3
Adding that backslash to $mp3 breaks the program.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.