![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2004
Posts: 17
Rep Power: 0
![]() |
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 |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
You could have the perl script use a system() call to execute that bash stuff. Or better yet you could use the time() function for your time and get the env. variable $USER for the username.
As far as a function to print a file, just use a system() call to lpr to print your file. ![]()
__________________
"Time is an illusion. Lunchtime doubly so." -the late, great Douglas Adams |
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() ![]() |
$sitename="TheWebSite";
$siteurl="http://www.thewebsite.com"; $description="The Web Site"; $sitedata="websites.dat"; open(DAT,">$sitedata") || die("Cannot Open File"); print DAT "$sitename\|$siteurl\|$description\n"; close(DAT);
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#4 |
|
Programmer
|
One liner...
print FILE "$sitename\|$siteurl\|$description\n" if open FILE, ">$sitedata"; Sorry... my Perl-fu is strong...
__________________
/* LANCE */ C++; /* this makes C bigger but returns the old value */ char *site = "slackwise.net", *home = "lance.slackwise.net", *pics = "flickr.com/photos/slackwise"; |
|
|
|
|
|
#5 |
|
Expert Programmer
|
Yeah, I am thinking just use file handles, unless you were looking at getting right into ps formatted output, in which case you need to look into using a plethora of command lines tools to generate the proper output, once of which is called "gv".
__________________
Clifford Matthew Roche <geek@cliffordroche.com> Web Hosting: http://www.crd-hosting.com Consulting: http://www.crdev-consulting.com |
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() ![]() |
Perl-fu.... hah. I still favor my Perl-jitsu... it makes readability a bit easier.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|