Perl-how to print to file
Hi folks,
Perl ==== Instead of using following command printing output to a file; $ perl AAA.pl > /pathto/name_of_file is it possible adding "print file function" to the script 1) If YES Please advise how to make it. 2) Can I add following bash syntax to the script user=$(whoami); now=$(date +%Y.%m.%d.%R); File="/tmp/satimis/comparison_${user}_${now}.txt"; so that the printout file will carry name of creator, date and time, etc. If possible please shed me some light to re-edit the script. TIA B.R. satimis |
u just have to pass the username to the perl script. open a filehandle in the script, write the output.
i guess u'll find some more info here... http://webdevelopment.developersnetw...sp?Article=139 |
Quote:
Tks for your advice and URL B.R. satimis |
your answer to question 2:
user=$(whoami); now=$(date +%Y.%m.%d.%R); File="/tmp/satimis/comparison_${user}_${now}.txt"; $user = `whoami`; $now = `date +%Y.%m.%d.%R` $File = "/tmp/satmis/comparison_$user_$now.txt" those aren't regualr single quoats, they the back tics that share a key with ~. basically $var = `command` will set the $var to whatever the output of the command is |
Hi sirclif,
Quote:
B.R. satimis |
All times are GMT -5. The time now is 12:14 AM. |