for $i (@tokens){$nn.=$tag->{$i}." $sep ";} my $z=rindex($nn,$sep); my $len=length $sep; substr($nn,$z,$len+1,''); chop $nn; $nn.='.mp3'; #### use MP3::Info; use strict; # # what's boo_radley listening to? # in CODE tag friendly format :) # my $fn = 'F:\Warlock Pinchers\Deadly Kung Fu Action '. '_ Pinch a Loaf\Warlock Pinchers - ' . 'Deadly Kung Fu Action _ Pinch a Loaf '. '- 06 - Black in Black.mp3'; my $tag=get_mp3tag($fn) || die "unable to get tag."; # tags to incorporate into new filename my @tokens = qw (ARTIST TITLE ALBUM GENRE); my $sep ="-"; my $nn; # from buu's script. # for my $i (@tokens){$nn.=$$tag{$i}." $sep "} my $z=rindex($nn,$sep); my $len=length $sep; substr($nn,$z,$len+1,''); chop $nn; $nn.='.mp3'; output the labors of our work print "\n$nn\n"; #using the $tag object as a hash (in hash slice form!) print join (" - ", @$tag{@tokens}),".mp3"; #### print "Renamed $_ to $nn \n" if rename $_,$nn; #### unless (-e $fn) { print "Renamed $_ to $nn \n" if rename $_,$nn } else { # for example ... push(@errors,"Tried to rename $_ to $nn, file exists\n") }