PDA

View Full Version : Perl - how to print to file



satimis
13th November 2004, 04:59 AM
Hi folks,

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

james_in_denver
13th November 2004, 06:13 AM
I think you need to study the PERL language some more.

Yes, Perl has this capability, all you have to do is open a file for read/write access.

I think that perhaps you should visit
http://www.perl.org/