[6439] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 64 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 6 13:57:41 1997

Date: Thu, 6 Mar 97 10:01:31 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 6 Mar 1997     Volume: 8 Number: 64

Today's topics:
     perl program works on command line, but not when run th <cengel@nh1adm.uwaterloo.ca>
     perl program works on command line, but not when run th <cengel@nh1adm.uwaterloo.ca>
     perl program works on command line, but not when run th <cengel@nh1adm.uwaterloo.ca>
     perl program works on command line, but not when run th <cengel@nh1adm.uwaterloo.ca>
     perl program works on command line, but not when run th <cengel@nh1adm.uwaterloo.ca>
     Perl usage on wintel boxes (Robert Sebesta)
     Print to Multiple Filehandles <toml@synnet.com>
     Re: Random Temp File in Perl 5.002 <eryq@enteract.com>
     Reading from a file in an array arbitrary ???? <r.i.evers@student.utwente.nl>
     Re: Reading from a file in an array arbitrary ???? (Honza Pazdziora)
     Re: Where is FAQ? <tchrist@mox.perl.com>
     Re: Which one is the best (pattern matching) (Clinton Pierce)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 06 Mar 1997 04:53:37 -0400
From: Chris Engel <cengel@nh1adm.uwaterloo.ca>
Subject: perl program works on command line, but not when run through www server
Message-Id: <331E8611.4D62@nh1adm.uwaterloo.ca>

Hi folks.  I have been banging my head against the wall trying
to figure out what I'm doing wrong.  I am trying to write a 
perl program that will schedule appointments for me.  The 
The first part of the program reads in data from a file in which
appointment data is stored.  The format of the file is:

time:name

for example:

900:x
945:Chris
1030:M. Jones

and so on.  The program reads the file, and if it sees an
x, then it will print the time, the word "available" and a 
radio button.  If it doesn't see an x, then it prints the 
time and the name.

The problem is this:  when I run the program using 
perl -w showappt.cgi,  I get a warning saying 
use of uninitialized variable.  This warning is given when
the if statements are executed.  However, the program
saves the printout to the file, and when I look at the file,
everything comes out the way that I wanted.

However, when I try and run the program using lynx or netscape,
the program doesn't save anything that was printed from the 
print statements.  It will print everything else.  

Originally, I had things set up so that the program would print
out straight to the browser.  I saved things to a file and then
opened a file (html formatted), and then read the file, hoping 
to find the error.  No luck.

The part of the program in question is shown below:

#Now lets open the datafile for that date and establish the 
#name-value pairs for the data


open (DATES, "<mar0397.dat");
@dates = <DATES>;
close(DATES);

$date = "March 3, 1997";
#$schedule_file_html = "mar0397.html";
#With the data read in from the appointment schedule for that
#date, we now display the schedule.  If the time slot is open
# a radio button is created.  If the time slot is not open,
# the name of the person who reserved that time slot is 
#shown.
open (SCHEDULE,">mar0397.html");

print SCHEDULE "<html>\n";
print SCHEDULE "<head>\n";
print SCHEDULE "<title>\n";
print SCHEDULE "Schedule\n";
print SCHEDULE "</title>\n";
print SCHEDULE "</head>\n";
print SCHEDULE "<body bgcolor=\"#ffffff\">\n";
print SCHEDULE "<h1><center>Schedule for $date\n";
print SCHEDULE "<p>\n";
print SCHEDULE "</center></h1><br>\n";
print SCHEDULE "<form method = \"POST\" action = \"readenv.cgi\">\n";
print SCHEDULE "<input type = \"hidden\" name = \"date\" value = \"March 
03\">\n"; 
print SCHEDULE "<p>\n";
print "@dates\n";
open (DATES,"<mar0397.dat");
while (<DATES>) {
chop;
($time,$student) = split(/:/,$_,2);
print "help help help";
if ($time eq "900") {
$proper_time = "9:00 am";
}
elsif ($time eq "945") {
$proper_time = "9:45 am";
}
elsif ($time eq "1030") {
$proper_time = "10:30 am";
}
elsif ($time eq "1115") {
$proper_time = "11:15 am";
}
elsif ($time eq "1300") {
$proper_time = "1:00 pm";
}
elsif ($time eq "1345") {
$proper_time = "1:45 pm";
}
elsif ($time eq "1430") {
$proper_time = "2:30 pm";
}
elsif ($time eq "1515") {
$proper_time = "3:15 pm";
}
elsif ($time eq "1600") {
$proper_time = "4:00 pm";
}
else {
}
if ($student eq "x") {
print SCHEDULE "$proper_time \t available \t <input type = \"radio\" name 
= \"time\" value =\"$time\"><br>\n";
}
else {
print SCHEDULE "$proper_time \t $student<br>\n";
}
}
print SCHEDULE "<center>\n";
print SCHEDULE "<input type = \"submit\" value = \"Reserve your time\"> 
or 
<input type = \"reset\" value = \"Redo your selection\"><br>\n";
print SCHEDULE "</center><br>\n";
print SCHEDULE "</form>\n";
print SCHEDULE "</body></html>\n";
close SCHEDULE;

print "Content-type: text/html\n\n";
open(SCHEDULE_FILE, "<mar0397.html");
while(<SCHEDULE_FILE>) {
print;
}
close SCHEDULE_FILE;
}

So, to summarize:

perl -w showappt.cgi will show use of uninitialized variables 
in the if statements.

When executed from the command line, mar0397.html file will have
the proper html code.

When executed using lynx or netscape, the file will not show
any print statements executed from the if statements.

I have checked the if statements, and they are executing 
properly.  I printed out the @dates file (bad name, I know) and 
the information is being read in properly.

Any help would be greatly appreciated!

Chris Engel


------------------------------

Date: Thu, 06 Mar 1997 04:55:04 -0400
From: Chris Engel <cengel@nh1adm.uwaterloo.ca>
Subject: perl program works on command line, but not when run through www server
Message-Id: <331E8668.2A8D@nh1adm.uwaterloo.ca>

Hi folks.  I have been banging my head against the wall trying
to figure out what I'm doing wrong.  I am trying to write a 
perl program that will schedule appointments for me.  The 
The first part of the program reads in data from a file in which
appointment data is stored.  The format of the file is:

time:name

for example:

900:x
945:Chris
1030:M. Jones

and so on.  The program reads the file, and if it sees an
x, then it will print the time, the word "available" and a 
radio button.  If it doesn't see an x, then it prints the 
time and the name.

The problem is this:  when I run the program using 
perl -w showappt.cgi,  I get a warning saying 
use of uninitialized variable.  This warning is given when
the if statements are executed.  However, the program
saves the printout to the file, and when I look at the file,
everything comes out the way that I wanted.

However, when I try and run the program using lynx or netscape,
the program doesn't save anything that was printed from the 
print statements.  It will print everything else.  

Originally, I had things set up so that the program would print
out straight to the browser.  I saved things to a file and then
opened a file (html formatted), and then read the file, hoping 
to find the error.  No luck.

The part of the program in question is shown below:

#Now lets open the datafile for that date and establish the 
#name-value pairs for the data


open (DATES, "<mar0397.dat");
@dates = <DATES>;
close(DATES);

$date = "March 3, 1997";
#$schedule_file_html = "mar0397.html";
#With the data read in from the appointment schedule for that
#date, we now display the schedule.  If the time slot is open
# a radio button is created.  If the time slot is not open,
# the name of the person who reserved that time slot is 
#shown.
open (SCHEDULE,">mar0397.html");

print SCHEDULE "<html>\n";
print SCHEDULE "<head>\n";
print SCHEDULE "<title>\n";
print SCHEDULE "Schedule\n";
print SCHEDULE "</title>\n";
print SCHEDULE "</head>\n";
print SCHEDULE "<body bgcolor=\"#ffffff\">\n";
print SCHEDULE "<h1><center>Schedule for $date\n";
print SCHEDULE "<p>\n";
print SCHEDULE "</center></h1><br>\n";
print SCHEDULE "<form method = \"POST\" action = \"readenv.cgi\">\n";
print SCHEDULE "<input type = \"hidden\" name = \"date\" value = \"March 
03\">\n"; 
print SCHEDULE "<p>\n";
print "@dates\n";
open (DATES,"<mar0397.dat");
while (<DATES>) {
chop;
($time,$student) = split(/:/,$_,2);
print "help help help";
if ($time eq "900") {
$proper_time = "9:00 am";
}
elsif ($time eq "945") {
$proper_time = "9:45 am";
}
elsif ($time eq "1030") {
$proper_time = "10:30 am";
}
elsif ($time eq "1115") {
$proper_time = "11:15 am";
}
elsif ($time eq "1300") {
$proper_time = "1:00 pm";
}
elsif ($time eq "1345") {
$proper_time = "1:45 pm";
}
elsif ($time eq "1430") {
$proper_time = "2:30 pm";
}
elsif ($time eq "1515") {
$proper_time = "3:15 pm";
}
elsif ($time eq "1600") {
$proper_time = "4:00 pm";
}
else {
}
if ($student eq "x") {
print SCHEDULE "$proper_time \t available \t <input type = \"radio\" name 
= \"time\" value =\"$time\"><br>\n";
}
else {
print SCHEDULE "$proper_time \t $student<br>\n";
}
}
print SCHEDULE "<center>\n";
print SCHEDULE "<input type = \"submit\" value = \"Reserve your time\"> 
or 
<input type = \"reset\" value = \"Redo your selection\"><br>\n";
print SCHEDULE "</center><br>\n";
print SCHEDULE "</form>\n";
print SCHEDULE "</body></html>\n";
close SCHEDULE;

print "Content-type: text/html\n\n";
open(SCHEDULE_FILE, "<mar0397.html");
while(<SCHEDULE_FILE>) {
print;
}
close SCHEDULE_FILE;
}

So, to summarize:

perl -w showappt.cgi will show use of uninitialized variables 
in the if statements.

When executed from the command line, mar0397.html file will have
the proper html code.

When executed using lynx or netscape, the file will not show
any print statements executed from the if statements.

I have checked the if statements, and they are executing 
properly.  I printed out the @dates file (bad name, I know) and 
the information is being read in properly.

Any help would be greatly appreciated!

Chris Engel


------------------------------

Date: Thu, 06 Mar 1997 04:57:17 -0400
From: Chris Engel <cengel@nh1adm.uwaterloo.ca>
Subject: perl program works on command line, but not when run through www server
Message-Id: <331E86ED.4ED0@nh1adm.uwaterloo.ca>

Hi folks.  I have been banging my head against the wall trying
to figure out what I'm doing wrong.  I am trying to write a 
perl program that will schedule appointments for me.  The 
The first part of the program reads in data from a file in which
appointment data is stored.  The format of the file is:

time:name

for example:

900:x
945:Chris
1030:M. Jones

and so on.  The program reads the file, and if it sees an
x, then it will print the time, the word "available" and a 
radio button.  If it doesn't see an x, then it prints the 
time and the name.

The problem is this:  when I run the program using 
perl -w showappt.cgi,  I get a warning saying 
use of uninitialized variable.  This warning is given when
the if statements are executed.  However, the program
saves the printout to the file, and when I look at the file,
everything comes out the way that I wanted.

However, when I try and run the program using lynx or netscape,
the program doesn't save anything that was printed from the 
print statements.  It will print everything else.  

Originally, I had things set up so that the program would print
out straight to the browser.  I saved things to a file and then
opened a file (html formatted), and then read the file, hoping 
to find the error.  No luck.

The part of the program in question is shown below:

#Now lets open the datafile for that date and establish the 
#name-value pairs for the data


open (DATES, "<mar0397.dat");
@dates = <DATES>;
close(DATES);

$date = "March 3, 1997";
#$schedule_file_html = "mar0397.html";
#With the data read in from the appointment schedule for that
#date, we now display the schedule.  If the time slot is open
# a radio button is created.  If the time slot is not open,
# the name of the person who reserved that time slot is 
#shown.
open (SCHEDULE,">mar0397.html");

print SCHEDULE "<html>\n";
print SCHEDULE "<head>\n";
print SCHEDULE "<title>\n";
print SCHEDULE "Schedule\n";
print SCHEDULE "</title>\n";
print SCHEDULE "</head>\n";
print SCHEDULE "<body bgcolor=\"#ffffff\">\n";
print SCHEDULE "<h1><center>Schedule for $date\n";
print SCHEDULE "<p>\n";
print SCHEDULE "</center></h1><br>\n";
print SCHEDULE "<form method = \"POST\" action = \"readenv.cgi\">\n";
print SCHEDULE "<input type = \"hidden\" name = \"date\" value = \"March 
03\">\n"; 
print SCHEDULE "<p>\n";
print "@dates\n";
open (DATES,"<mar0397.dat");
while (<DATES>) {
chop;
($time,$student) = split(/:/,$_,2);
print "help help help";
if ($time eq "900") {
$proper_time = "9:00 am";
}
elsif ($time eq "945") {
$proper_time = "9:45 am";
}
elsif ($time eq "1030") {
$proper_time = "10:30 am";
}
elsif ($time eq "1115") {
$proper_time = "11:15 am";
}
elsif ($time eq "1300") {
$proper_time = "1:00 pm";
}
elsif ($time eq "1345") {
$proper_time = "1:45 pm";
}
elsif ($time eq "1430") {
$proper_time = "2:30 pm";
}
elsif ($time eq "1515") {
$proper_time = "3:15 pm";
}
elsif ($time eq "1600") {
$proper_time = "4:00 pm";
}
else {
}
if ($student eq "x") {
print SCHEDULE "$proper_time \t available \t <input type = \"radio\" name 
= \"time\" value =\"$time\"><br>\n";
}
else {
print SCHEDULE "$proper_time \t $student<br>\n";
}
}
print SCHEDULE "<center>\n";
print SCHEDULE "<input type = \"submit\" value = \"Reserve your time\"> or 
<input type = \"reset\" value = \"Redo your selection\"><br>\n";
print SCHEDULE "</center><br>\n";
print SCHEDULE "</form>\n";
print SCHEDULE "</body></html>\n";
close SCHEDULE;

print "Content-type: text/html\n\n";
open(SCHEDULE_FILE, "<mar0397.html");
while(<SCHEDULE_FILE>) {
print;
}
close SCHEDULE_FILE;
}

So, to summarize:

perl -w showappt.cgi will show use of uninitialized variables 
in the if statements.

When executed from the command line, mar0397.html file will have
the proper html code.

When executed using lynx or netscape, the file will not show
any print statements executed from the if statements.

I have checked the if statements, and they are executing 
properly.  I printed out the @dates file (bad name, I know) and 
the information is being read in properly.

Any help would be greatly appreciated!

Chris Engel


------------------------------

Date: Thu, 06 Mar 1997 04:56:41 -0400
From: Chris Engel <cengel@nh1adm.uwaterloo.ca>
Subject: perl program works on command line, but not when run through www server
Message-Id: <331E86C9.19C0@nh1adm.uwaterloo.ca>

Hi folks.  I have been banging my head against the wall trying
to figure out what I'm doing wrong.  I am trying to write a 
perl program that will schedule appointments for me.  The 
The first part of the program reads in data from a file in which
appointment data is stored.  The format of the file is:

time:name

for example:

900:x
945:Chris
1030:M. Jones

and so on.  The program reads the file, and if it sees an
x, then it will print the time, the word "available" and a 
radio button.  If it doesn't see an x, then it prints the 
time and the name.

The problem is this:  when I run the program using 
perl -w showappt.cgi,  I get a warning saying 
use of uninitialized variable.  This warning is given when
the if statements are executed.  However, the program
saves the printout to the file, and when I look at the file,
everything comes out the way that I wanted.

However, when I try and run the program using lynx or netscape,
the program doesn't save anything that was printed from the 
print statements.  It will print everything else.  

Originally, I had things set up so that the program would print
out straight to the browser.  I saved things to a file and then
opened a file (html formatted), and then read the file, hoping 
to find the error.  No luck.

The part of the program in question is shown below:

#Now lets open the datafile for that date and establish the 
#name-value pairs for the data


open (DATES, "<mar0397.dat");
@dates = <DATES>;
close(DATES);

$date = "March 3, 1997";
#$schedule_file_html = "mar0397.html";
#With the data read in from the appointment schedule for that
#date, we now display the schedule.  If the time slot is open
# a radio button is created.  If the time slot is not open,
# the name of the person who reserved that time slot is 
#shown.
open (SCHEDULE,">mar0397.html");

print SCHEDULE "<html>\n";
print SCHEDULE "<head>\n";
print SCHEDULE "<title>\n";
print SCHEDULE "Schedule\n";
print SCHEDULE "</title>\n";
print SCHEDULE "</head>\n";
print SCHEDULE "<body bgcolor=\"#ffffff\">\n";
print SCHEDULE "<h1><center>Schedule for $date\n";
print SCHEDULE "<p>\n";
print SCHEDULE "</center></h1><br>\n";
print SCHEDULE "<form method = \"POST\" action = \"readenv.cgi\">\n";
print SCHEDULE "<input type = \"hidden\" name = \"date\" value = \"March 
03\">\n"; 
print SCHEDULE "<p>\n";
print "@dates\n";
open (DATES,"<mar0397.dat");
while (<DATES>) {
chop;
($time,$student) = split(/:/,$_,2);
print "help help help";
if ($time eq "900") {
$proper_time = "9:00 am";
}
elsif ($time eq "945") {
$proper_time = "9:45 am";
}
elsif ($time eq "1030") {
$proper_time = "10:30 am";
}
elsif ($time eq "1115") {
$proper_time = "11:15 am";
}
elsif ($time eq "1300") {
$proper_time = "1:00 pm";
}
elsif ($time eq "1345") {
$proper_time = "1:45 pm";
}
elsif ($time eq "1430") {
$proper_time = "2:30 pm";
}
elsif ($time eq "1515") {
$proper_time = "3:15 pm";
}
elsif ($time eq "1600") {
$proper_time = "4:00 pm";
}
else {
}
if ($student eq "x") {
print SCHEDULE "$proper_time \t available \t <input type = \"radio\" name 
= \"time\" value =\"$time\"><br>\n";
}
else {
print SCHEDULE "$proper_time \t $student<br>\n";
}
}
print SCHEDULE "<center>\n";
print SCHEDULE "<input type = \"submit\" value = \"Reserve your time\"> or 
<input type = \"reset\" value = \"Redo your selection\"><br>\n";
print SCHEDULE "</center><br>\n";
print SCHEDULE "</form>\n";
print SCHEDULE "</body></html>\n";
close SCHEDULE;

print "Content-type: text/html\n\n";
open(SCHEDULE_FILE, "<mar0397.html");
while(<SCHEDULE_FILE>) {
print;
}
close SCHEDULE_FILE;
}

So, to summarize:

perl -w showappt.cgi will show use of uninitialized variables 
in the if statements.

When executed from the command line, mar0397.html file will have
the proper html code.

When executed using lynx or netscape, the file will not show
any print statements executed from the if statements.

I have checked the if statements, and they are executing 
properly.  I printed out the @dates file (bad name, I know) and 
the information is being read in properly.

Any help would be greatly appreciated!

Chris Engel


------------------------------

Date: Thu, 06 Mar 1997 04:56:14 -0400
From: Chris Engel <cengel@nh1adm.uwaterloo.ca>
Subject: perl program works on command line, but not when run through www server
Message-Id: <331E86AE.60B2@nh1adm.uwaterloo.ca>

Hi folks.  I have been banging my head against the wall trying
to figure out what I'm doing wrong.  I am trying to write a 
perl program that will schedule appointments for me.  The 
The first part of the program reads in data from a file in which
appointment data is stored.  The format of the file is:

time:name

for example:

900:x
945:Chris
1030:M. Jones

and so on.  The program reads the file, and if it sees an
x, then it will print the time, the word "available" and a 
radio button.  If it doesn't see an x, then it prints the 
time and the name.

The problem is this:  when I run the program using 
perl -w showappt.cgi,  I get a warning saying 
use of uninitialized variable.  This warning is given when
the if statements are executed.  However, the program
saves the printout to the file, and when I look at the file,
everything comes out the way that I wanted.

However, when I try and run the program using lynx or netscape,
the program doesn't save anything that was printed from the 
print statements.  It will print everything else.  

Originally, I had things set up so that the program would print
out straight to the browser.  I saved things to a file and then
opened a file (html formatted), and then read the file, hoping 
to find the error.  No luck.

The part of the program in question is shown below:

#Now lets open the datafile for that date and establish the 
#name-value pairs for the data


open (DATES, "<mar0397.dat");
@dates = <DATES>;
close(DATES);

$date = "March 3, 1997";
#$schedule_file_html = "mar0397.html";
#With the data read in from the appointment schedule for that
#date, we now display the schedule.  If the time slot is open
# a radio button is created.  If the time slot is not open,
# the name of the person who reserved that time slot is 
#shown.
open (SCHEDULE,">mar0397.html");

print SCHEDULE "<html>\n";
print SCHEDULE "<head>\n";
print SCHEDULE "<title>\n";
print SCHEDULE "Schedule\n";
print SCHEDULE "</title>\n";
print SCHEDULE "</head>\n";
print SCHEDULE "<body bgcolor=\"#ffffff\">\n";
print SCHEDULE "<h1><center>Schedule for $date\n";
print SCHEDULE "<p>\n";
print SCHEDULE "</center></h1><br>\n";
print SCHEDULE "<form method = \"POST\" action = \"readenv.cgi\">\n";
print SCHEDULE "<input type = \"hidden\" name = \"date\" value = \"March 
03\">\n"; 
print SCHEDULE "<p>\n";
print "@dates\n";
open (DATES,"<mar0397.dat");
while (<DATES>) {
chop;
($time,$student) = split(/:/,$_,2);
print "help help help";
if ($time eq "900") {
$proper_time = "9:00 am";
}
elsif ($time eq "945") {
$proper_time = "9:45 am";
}
elsif ($time eq "1030") {
$proper_time = "10:30 am";
}
elsif ($time eq "1115") {
$proper_time = "11:15 am";
}
elsif ($time eq "1300") {
$proper_time = "1:00 pm";
}
elsif ($time eq "1345") {
$proper_time = "1:45 pm";
}
elsif ($time eq "1430") {
$proper_time = "2:30 pm";
}
elsif ($time eq "1515") {
$proper_time = "3:15 pm";
}
elsif ($time eq "1600") {
$proper_time = "4:00 pm";
}
else {
}
if ($student eq "x") {
print SCHEDULE "$proper_time \t available \t <input type = \"radio\" name 
= \"time\" value =\"$time\"><br>\n";
}
else {
print SCHEDULE "$proper_time \t $student<br>\n";
}
}
print SCHEDULE "<center>\n";
print SCHEDULE "<input type = \"submit\" value = \"Reserve your time\"> or 
<input type = \"reset\" value = \"Redo your selection\"><br>\n";
print SCHEDULE "</center><br>\n";
print SCHEDULE "</form>\n";
print SCHEDULE "</body></html>\n";
close SCHEDULE;

print "Content-type: text/html\n\n";
open(SCHEDULE_FILE, "<mar0397.html");
while(<SCHEDULE_FILE>) {
print;
}
close SCHEDULE_FILE;
}

So, to summarize:

perl -w showappt.cgi will show use of uninitialized variables 
in the if statements.

When executed from the command line, mar0397.html file will have
the proper html code.

When executed using lynx or netscape, the file will not show
any print statements executed from the if statements.

I have checked the if statements, and they are executing 
properly.  I printed out the @dates file (bad name, I know) and 
the information is being read in properly.

Any help would be greatly appreciated!

Chris Engel


------------------------------

Date: 6 Mar 1997 17:03:33 GMT
From: rws@sneffels.uccs.edu (Robert Sebesta)
Subject: Perl usage on wintel boxes
Message-Id: <5fmtd5$1n3@harpo.uccs.edu>

Does anyone have any statistics or educated guesses as to
the percentage of all Perl programming that is done on
wintel boxes? Any information on this would be appreciated.

Bob Sebesta - University of Colorado at Colorado Springs




------------------------------

Date: Thu, 06 Mar 1997 09:46:56 -0500
From: Tom Lynch <toml@synnet.com>
Subject: Print to Multiple Filehandles
Message-Id: <331ED8E0.77FC@synnet.com>

Greetings:

	I have a couple of Filehandles open and would like
	to print the same text to each one, only when a 
	certain condition is hit. Currently I do
	
	print FILE1 "Todays Date\n";
	print FILE2 "Todays Date\n";
	print FILE3 "Todays Date\n";

	Does perl have a way to just put this as one statement?
	Like:

	print (FILE1, FILE2, FILE3) " Today's Date\n";

	I suppose I could put the files to a list, and do
	a foreach to open, print then close each one here,
	but I thought there might be a better way.

	Thanks for any and all help.

	Tom 

--


------------------------------

Date: Thu, 06 Mar 1997 11:27:02 -0600
From: Eryq <eryq@enteract.com>
To: Monte Mitzelfelt <monte@conchas.nm.org>
Subject: Re: Random Temp File in Perl 5.002
Message-Id: <331EFE66.385D75A3@enteract.com>

Monte Mitzelfelt wrote:
> 
> Mark Thompson wrote:
> 
> > I need to make a random temporary file, sortof like tmpnam() in C.
> > Does Perl offer this functionality?  If not, any suggestions on how to
> > implement something like this?

Yes.  POSIX::tmpnam(), I think.   :-)

 
> You could try something like:
> 
> $tmp = 'aaaa' ;
> $tmp++ while -e ( $tempfile = "/tmp/XXX$tmp" ) ;
> open FILE, "> $tempfile"  or die "Can't open $tempfile: $!" ;
> 
> Perl will increment the file name "automagically" and the while modifier
> will keep doing this as long as a file with that name exists.

I'd put the PID in there as well, if there's even the remotest possibility
that your program could be run by two users simultaneously.

	"/tmp/XXX$tmp$$"

-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
 / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
|  __/| | | |_| | |_| |   http://www.enteract.com/~eryq
 \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
           |___/    |______/ of the homeless: http://www.streetwise.org


------------------------------

Date: 6 Mar 1997 15:20:07 GMT
From: "R. Evers" <r.i.evers@student.utwente.nl>
Subject: Reading from a file in an array arbitrary ????
Message-Id: <01bc2a42$49c72f90$97df5982@doco>

Hi guys,

I have a question (like everyone who posts to this newsgroup)....
I want to read a file into an array.
The problem is:
I don't want to read all, just a few lines from the file.

To clear the problem, the usual codes to read a file into an array will be:
open (FILE, "$FileName");
@FileArray = <FILE>;
close(FILE);

The above is what I usual do. However it will be a problem if I want to
read a file that contains more than 5000 lines. Imagines how big the array
is.

The question: Do you know how to see how many lines a file contains ????
	OR
Anyone knows a better way ?????

Thanx guys........

Greetings from Holland
R. Evers



------------------------------

Date: Thu, 6 Mar 1997 16:49:00 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Reading from a file in an array arbitrary ????
Message-Id: <adelton.857666940@aisa.fi.muni.cz>

"R. Evers" <r.i.evers@student.utwente.nl> writes:

> Hi guys,
> 
> I have a question (like everyone who posts to this newsgroup)....
> I want to read a file into an array.
> The problem is:
> I don't want to read all, just a few lines from the file.
> 
> To clear the problem, the usual codes to read a file into an array will be:
> open (FILE, "$FileName");
> @FileArray = <FILE>;
> close(FILE);
> 
> The above is what I usual do. However it will be a problem if I want to
> read a file that contains more than 5000 lines. Imagines how big the array
> is.
> 
> The question: Do you know how to see how many lines a file contains ????

You have to count the number of newlines (\n) in the file.

> 	OR
> Anyone knows a better way ?????

Better way to what? If you need to write the file into the array, just
do it. If you do not have to have the whole thing in memory, do

while (<>)
	{
	# process $_;
	}

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


------------------------------

Date: 6 Mar 1997 16:35:08 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Where is FAQ?
Message-Id: <5fmrns$dn6$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
:If, however, it is the official replacement for the Meta-FAQ, I will
:include it in the archive and mailserver here.

If there's something that should there, please tell us about it.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    pos += screamnext[pos]  /* does this goof up anywhere? */
        --Larry Wall in util.c from the perl source code


------------------------------

Date: 6 Mar 1997 16:23:43 GMT
From: cpierce1@cp501.fsic.ford.com (Clinton Pierce)
Subject: Re: Which one is the best (pattern matching)
Message-Id: <5fmr2f$4l99@eccws1.dearborn.ford.com>

In article <5fkvps$liu@neocad.xilinx.com>,
	stampes@xilinx.com (Jeff Stampes) writes:
>Dylan Northrup (northrup@chem.ufl.edu) wrote:
>: =:
>: =:: Are you trying to start a religion?
>: =:
>: =:Too late.   ;-)
>
>: alt.religion.perl anyone?
>
>the ten commandments:
>
>1) Thou shall use -w
>2) thou shall not ask cgi programming questions
>3) Thou shall RTFM
>4) Thou shall not try to validate e-mail addresse
>5) Thou shall not use perl4
>6) Thou shall heed the latro warning
>7) Thou shall have a bible handy at all times (Programming Perl, 2nd Ed)
>8) Thou shall not write obfuscated code for others to maintain
>9) Thou shall check return stati of functions
>10) Thou shall use -w
>
>Do we get to offer up violaters of #2 and #4 as human sacrifice?

No, we make them port the Perl interpreter to COBOL.  Death is too kind.

-- 
+----------------------------------------------------------------------------+
|    Clinton A. Pierce      |   "If you rush a Miracle Man,   | http://www.  |
|    cpierce1@ford.com      |     you get rotten miracles"    | dcicorp.com/ |
|     cpierce@mica.net      |--Miracle Max, The Pricess Bride | ~clintp      |
+----------------------------------------------------------------------------+
GCM/GCSd-s+:+a-C++UALIS++++P++++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*



------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 64
************************************

home help back first fref pref prev next nref lref last post