Elias, et al -- ...and then Elias Assmann said... % % Oh my, what a bad day for my poor little brain... Sorry for all that % confusion.
*grin* No problem; it made me check my answers :-)
%
% On Sun, 9 Jun 2002, David T-G wrote:
%
% > ...and then Elias Assmann said...
% >
% > % be two lines, so how about this: @working = m'/mp3(/[^/]+)+';?
%
% It seems I have suffered a misconception about what (pat)+ would do...
%
% I toyed a bit with this, but I couldn't get it to put anything into
% @working except for the last (/[^/]). That is, with an input of
Yeah. Ugh.
% "/mp3/foo/bar/qux", @working would end up with only one element,
% "/qux". I don't think this idea will get us anywhere -- of course you
Right.
% could do "my($tmp) = m'^/mp3(.*)'; @working = $tmp =~ m'(/[^/]+)'g",
% but that's two lines again, and ugly :-)
Indeed. It loses style points :-)
%
% > Let's see what this does here, because it might point to the right track.
% > I'd love to be able to
% >
% > @working = split ( /\//, $fullname-without-/mp3/-on-it )
%
% If you know that you'll only ever need to leave out "/mp3", you could
% do just this: @working = split ("/", substr($_, 5));
Ahhhh... Now *that* is an interesting approach. I like that. I'm going
to try it. The /mp3 prefix is something of which I *can* be sure.
Well, it does make things a bit rigid, but no more so than the current
(undef,undef,@working) = ...
approach which assumes that there will be a /mp3/ to waste. I guess the
best would be to specifically strip the /mp3 off. Maybe a substr that
starts at an index which points to the first char after /mp3/ perhaps?
Hmmm... We'd actually have to have a ternary test that returns such an
index if it matches and 0 if it doesn't; it wouldnt' do to have an undef
starting place. And does index return the beginning or end of the match?
Back to the books... That's starting to sound obfuscated anyway :-)
%
% (Note, however, that this does not leave out "/mp3" but "/mp3/" -- if
% you use 4 instead of 5 as the second argument to substr, you'll get an
% empty field at the beginning, and I assume that's not what you
% need...)
Right; I do want 5.
%
% > % Also, I think File::Basename might help you (perldoc -f, *hint hint*
% > % :-).
% > Hmmm... I must be doing something wrong:
% >
% > [zero] [12:37pm] ~> perldoc -f File::Basename
% > No documentation for perl function `File::Basename' found
%
% Humph (see also above...). That should have been perldoc, without the
% -f. Humph.
Ah. Oh, I get it; I probably should have though of that myself :-)
%
% Also, I'm not sure it'll help you either (I haven't read the
% perldoc-page or anything :-), it just sounded like a good idea... So
% if you say it doesn't help you, I guess you'll be right.
Well, I could also have missed something. Your strong hint made me
wonder.
%
% H *T* H now...
There's at least one gem in it! :-)
%
% Elias
% --
Thanks & HAND
:-D
--
David T-G * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
msg25717/pgp00000.pgp
Description: PGP signature
