Check out page 219 of the Perl Cookbook... s(^.*/)()
Chris ----- Original Message ----- From: "K Clark" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, March 22, 2002 8:14 AM Subject: RE: how to randomly choose mp3 from dir, print mp3_filename for e mailing to a list] > Here's what i have, and here's the problem. and here's what i 'think' i > have to learn/do to fix it: > > #/usr/bin/perl -w > use strict; > # > # script to randomly choose a song > # and embed html with a link to it > # > my @mp3 = glob("/www/mp3/*.mp3"); > # > # put while statement > my $mp3 =~ s#.*/##; > > srand; > print "http://www.quantifier.org/mp3" . "$mp3[rand(@mp3)]"; > > # end > > this returns > > [ken:bin](09:04am)$ perl randomsong.pl > http://www.quantifier.org/mp3/www/mp3/Hooverphonic vs Sneaker Pimps > - Shake the Underground Disease (Puppeteer Remix).mp3 > > so i get my random song, but i'm not trimming off the directory pathname > of /www/mp3. so i see something in 'learning perl' about globs, and > using a while statement. i can't figure out how to add that while still > declaring my $mp3. > > hints? > > ken > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]