On Sat, 8 Jun 2002, David T-G wrote:

> % I can't modify $fullpath because I'll use it later, but for parsing I
> % don't need the leading "/mp3/" part, and the only way I've found to get
> % rid of it elegantly is
> %
> %   ...
> %     @working = split(/\//,$fullpath) ;              # cut path in pieces
> %     shift @working ; shift @working ;               # strip [what was] /mp3
> %   ...
>
> While it may not be a perfect solution, I hit upon
>
>     (undef,undef,@working) =                  # peel off /mp3 ...
>       split(/\//,$fullpath) ;                 # ... as we split into pieces
>
> and find it much of an improvement.  Further improvement is welcome :-)

If you care only about "/mp3", why not just remove "/mp3"? Like so:
s'/mp3''; -- and then split happily away. But, of course, that would
be two lines, so how about this: @working = m'/mp3(/[^/]+)+';?

Also, I think File::Basename might help you (perldoc -f, *hint hint*
:-).

TMTOWTDI,

        Elias

-- 
Gefängnis für Hans Mustermann wegen
Fälschung und Verrat

         -- Die Einstürzenden Neubauten, Was ist ist


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to