my random mp3 script works with strict and warnings (yeah!). now, i want
to do a second task with it, which is additionally write the data of
$inc to a file, named mp3.inc. Here's what i have. i can't find the
reference to doing this. even the correct perldoc pointer would be
wonderful.
#/usr/bin/perl -w
use strict;
my @mp3 = glob("/www/mp3/*.mp3");
foreach my $mp3 (@mp3){
$mp3 =~ s#/www/mp3##;
$mp3 =~ s/ /%20/g;
}
srand;
my $inc = "http://www.quantifier.org/mp3" . "$mp3[rand(@mp3)] \n";
print "$inc";
open(MP3 ">/home/ken/public_html/rt/mp3.inc") ||
die "Sorry, couldn't do that \n";
#
# this is where i'm stuck, how to write/print $inc into mp3.inc
#
close(MP3) || die "couldn't close \n";
#######
1. how do i write the contents of a scalar variable directly to a file?
2. for future scripts, are there areas where i can be more efficient?
ken
_____________________________________
http://quantifier.org GnuPG: 7C828670
<Addi> Alter.net seems to have replaced one of its router with a zucchini.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]