read up on substitution. You need to put the array through a foreach loop.

foreach my $mp3 (@mp3s){
        $mp3 =~ s#/www/mp3/##;
        }


Can you e-mail me that MP3 (the one you used as an example)?

> -----Original Message-----
> From: K Clark [mailto:[EMAIL PROTECTED]]
> Sent: Friday, March 22, 2002 9:14 AM
> To: [EMAIL PROTECTED]
> 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]
> 

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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

Reply via email to