in reply to Combining regexes
one possible way demonstrated under the Perl debugger:
I don't know if this is any better.DB<1> $curdir = 'Y:\Music\Schubert\Lieder\Terfel'; DB<2> $startdir = 'Y:\Music'; DB<3> $curdir =~ s/^\Q$startdir\E\\//i; DB<4> $out = join "_", split /\\/, "$curdir.pls"; DB<5> p $out; Schubert_Lieder_Terfel.pls
You could even do it in a single code line:
Again, this is shorter, but I do not claim that this is any better, you decide.DB<7> $curdir = 'Y:\Music\Schubert\Lieder\Terfel'; DB<7> $startdir = 'Y:\Music'; DB<8> $out = join "_", map {s/^\Q$startdir\E\\//i; split /\\/, "$_. +pls"} $curdir ; DB<9> p $out Schubert_Lieder_Terfel.pls
|
|---|