Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: eXpanium file converterby a (Friar) |
on Feb 20, 2001 at 09:40 UTC ( [id://59583]=note: print w/replies, xml ) | Need Help?? |
A couple of things. Your method of passing arrays is
okay but could be troublesome if you've got big lists -
by doing: @newfiles = removenonmp3(@newfiles);
you 'flatten' @newfiles to a list, put it into the various
arrays @_, @args and the send it back as a list which
gets 'slurped' back into @newfiles. If you pass by
reference ("removenonmp3(\@newfiles)") you won't do
all that copying. For:@dirs = (@dirs, $Dateiname);
you should:push(@dirs, $Dateiname); Again,
it doesn't unravel/reravel (?) @dirs, just pushes the value
on the end. Add a 'closedir' for completeness. Your shortenfilename could use a hash, something like: Using MS's idea of 6 and ~X, you could then: which it to also point out that shortenfilenames seems to be returning the same array it gets, unchanged. Change $file isn't going to modify the array members. removemp, you probably want: That is, you want only files that end in '.mp3', not kiki_dee.mp3.tar.gz I think you'll be clobbering your log file everytime, as you're opening it in overwrite mode ('>eXpanium.log') each time. There's something odd about redefining the log file name in one sub and opening it in another. Log file names, unless you're numbering them (logfile1.log, logfile2.log) are probably better global. You pass @newfiles all the time, except for rename, probably should be consistent on that or just 'in-line' rename in main. Just some suggestions, YM will always V ... a
In Section
Code Catacombs
|
|