K Clark wrote: > > 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";
You should include the $! variable in your error message to find out why the open() failed. open(MP3 ">/home/ken/public_html/rt/mp3.inc") || die "Sorry, couldn't do that to /home/ken/public_html/rt/mp3.inc: $!"; > # > # this is where i'm stuck, how to write/print $inc into mp3.inc > # print MP3 $inc; > close(MP3) || die "couldn't close \n"; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]