perldoc -f print print FILEHANDLE LIST;
In your case: print MP3 "$inc\n"; # \n is a newline character > -----Original Message----- > From: K Clark [mailto:[EMAIL PROTECTED]] > Sent: Friday, March 22, 2002 3:40 PM > To: [EMAIL PROTECTED] > Subject: write variable's contents to file :WAS: how to > randomly choose > mp3 from dir, print mp3_filename for e mailing to a list > > > 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] > ---------------------------------------------------------------------------- -------------------- 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]