Ok, I finally got a chance to test it, and the problem with my code is that split expects a scalar as the second argument. This does work:
($temp) = $fullpath =~ m:/mp3/(.+):; @working = split /\//,$temp; because it is taking the list returned by the match and assigning it to the list with $temp as the only element. If I did this: $temp = $fullpath =~ m:/mp3/(.+):; @working = split /\//,$temp; then @working would be 1 because $temp is evaluating the list in scalar context, which returns the number of elements. DISCLAIMER: Someone please correct me if I am not using the appropriate terminology. The upside of what I mean is that if you do a $scalar = @array, then the variable $scalar now has the value of the number of elements in the array. Anyhoo, now we know why my suggestion didn't work. What we need to do, then is give split the first element of the list. Try this: @working = split(/\//,($fullpath =~ m:/mp3/(.+):)[0]); -----Original Message----- From: David T-G [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 09, 2002 1:43 PM To: perl beginners Cc: Timothy Johnson Subject: Re: shifting solved (was "Re: chomp-ing DOS lines, shifting, and a variable variable") Timothy, et al -- ....and then David T-G said... % % ...and then Timothy Johnson said... % % % % I can't test this where I am right now, but would something like this work? % % % % @working = split /\//,($fullpath =~ m|/mp3/(.+)|); #changed match delimiter % % I'm surprised to find that it does, but I'm glad I tested it. I thought Darn it; I didn't test enough stuff. Given the code @working = split("/",substr($fullpath,5)); # @working = split(/\//,($fullpath =~ m:/mp3/(.+):)); print "FULLPATH IS .$fullpath.\n"; ### print "WORKING IS .@working.\n"; ### exit 0; ### running the script this way gives me FULLPATH IS ./mp3/100.Masterpieces/Vol.1/01.BACH.Toccata.in.D.minor.mp3. WORKING IS .100.Masterpieces Vol.1 01.BACH.Toccata.in.D.minor.mp3. but swapping to the match line gives me FULLPATH IS ./mp3/100.Masterpieces/Vol.1/01.BACH.Toccata.in.D.minor.mp3. WORKING IS .1. because, I suppose, the match works and returns 1. Is there a way to feed that match output back to split? Good thing vim has multiple undo capability :-) Thanks anyway & 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! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]