strange filenames pattern match

A

Alythh

I have the beginning of a filename, say $songname,
and I have to pattern-match it with the complete filename, from a list
@allfiles taken from a directory.

Doing
foreach( @allfiles )
{
if ( /$songname/ )
{ $truename = $_ }
}

should work, only problem is filenames often include chars as (), etc
and I got a runtime error:

Unmatched ( before HERE mark in regex m/God Within Featuring Scott Har
- The Phoenix ( << HERE Ritm.mp3/ at
/0ale/excursions/digital/script/stream_smart.pl line 68.


<background>
it should work as wrapper to streamripper, to erase .mp3s saved but
incomplete, due to mpglib errors. If you used streamripper you'll know
what I mean.
Filename like that often seem like:
God Within Featuring Scott Har - The Phoenix (Ritm's River.mp3
</background>


Thanks for any help...

Alessandro Magni
 
W

Walter Roberson

:I have the beginning of a filename, say $songname,
:and I have to pattern-match it with the complete filename, from a list
:mad:allfiles taken from a directory.

:should work, only problem is filenames often include chars as (), etc

/\Q$songname\E/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,167
Latest member
SusanaSwan
Top