[6448] in Perl-Users-Digest
Perl-Users Digest, Issue: 73 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 7 23:07:19 1997
Date: Fri, 7 Mar 97 20:00:22 -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 Fri, 7 Mar 1997 Volume: 8 Number: 73
Today's topics:
Re: "define"-status doesn't follow on assignment? <tchrist@mox.perl.com>
Re: Alphabetical Order (Joel Earl)
Re: Can't run Perl from Win95 DOS command prompt? (Fred Elbel)
Re: compiling perl for irix6.2 <mconley@pms110.pms.ford.com>
Re: Creating NonExisting File with Perl <dbe@wgn.net>
Help with installing and using libwww <mstearns@darkwing.uoregon.edu>
how to install perl on Personal Web Server? me@home
Re: Initializing array contents to all zeros (Larry Prall)
is 'my' compile-time or run-time? <pratik@pretzel.com>
Re: is 'my' compile-time or run-time? (Dave Thomas)
Re: NDBM and flock (Chris Russo)
Newbie recursion question <citadel@dircon.co.uk>
Re: Opening files in subdirectories <tchrist@mox.perl.com>
Re: Path problem. <mconley@pms110.pms.ford.com>
Re: Perl help required. Begginer :( (Tad McClellan)
Re: perl program works on command line, but not when ru <cengel@oise.utoronto.ca>
RAND/SRAND query <asdrs2@gte.net>
Sybase Compile Problem (Chris Tyner)
Which version of Perl do I have? <keith.k.nakanishi@boeing.com>
Re: Which version of Perl do I have? (Nathan V. Patwardhan)
Re: Which version of Perl do I have? (Tad McClellan)
Re: Which version of Perl do I have? <jeff@networkers.com>
Re: Why are my rand() values so tiny? <ltomlin@ucs.indiana.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Mar 1997 02:24:44 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: "define"-status doesn't follow on assignment?
Message-Id: <5fqilc$k38$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
elias@telcontar.tc.cornell.edu (Doug Elias) writes:
:Please tell me what part of the Perl-spec this derives from:
It's from the defined() definition in perlfunc:
Another surprise is that using defined() on an entire array or hash
reports whether memory for that aggregate has ever been allocated.
So an array you set to the empty list appears undefined initially,
and one that once was full and that you then set to the empty list
still appears defined. You should instead use a simple test for size:
if (@an_array) { print "has array elements\n" }
if (%a_hash) { print "has hash members\n" }
Using undef() on these, however, does clear their memory and then
report them as not defined anymore, but you shoudln't do that unless
you don't plan to use them again, because it saves time when you load
them up again to have memory already ready to be filled.
This counter-intuitive behaviour of defined() on aggregates may be
changed, fixed, or broken in a future release of Perl.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"That's okay. Anyone whose opinion he cares about already knows that
he doesn't care about their opinion."
--Larry Wall
------------------------------
Date: 08 Mar 1997 00:49:56 GMT
From: earl@shadowfax.rchland.ibm.com (Joel Earl)
Subject: Re: Alphabetical Order
Message-Id: <EARL.97Mar7184956@shadowfax.rchland.ibm.com>
In article <331F37AA.3677@bangor.ac.uk> "G.Cheers" <mau006@bangor.ac.uk> writes:
> if contents of $sitename have initial letter = "a"
> ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
> can do this bit! can't do this bit!
look up "substr" in the man pages
--
Joel Earl, earl@vnet.ibm.com
Logic Analysis and Optimization
IBM Rochester, Minnesota
(507) 253-2304
------------------------------
Date: Sat, 08 Mar 1997 01:58:48 GMT
From: __felbel@csn.net__ (Fred Elbel)
Subject: Re: Can't run Perl from Win95 DOS command prompt?
Message-Id: <3325c526.7561525@news-2.csn.net>
> __felbel@csn.net__ (Fred Elbel) wrote:
>
> > When I try to run from a DOS command prompt line (a DOS window), the
> > response is "This program can not be run in DOS mode.". According to
> > several posts, and section 1.14 of Evangelo Prodromou's FAQ, Perl
> > should run OK from the command line.
On Thu, 06 Mar 1997 20:13:51 GMT, mlaker@contax.co.uk (Markus Laker)
wrote:
> Running 'in DOS mode' means restarting the machine in MS-DOS mode
> (Ctrl+Esc, U, M). That isn't the same as running inside a DOS prompt
> (which you can find on the Programs menu)....
Thanks for the thorough response! The mystery deepens. Yes, I am
running from a DOS command prompt, and the property Advanced/"suggest
MS-DOS mode as neccessary" is clicked. Just now, I found I *can* run
Perl OK from a command prompt. Yesterday, I could not. And I have
not changed this property between sessions.
I have also successfully run using the PL2bat batch file. I'll repost
if (and when) I get more diagnostics. Other thoughts would be
appreciated!
Regards,
Fred
-- Fred Elbel felbel@csn.net
------------------------------
Date: Fri, 07 Mar 1997 16:43:58 -0500
From: Mike Conley <mconley@pms110.pms.ford.com>
To: Greg Heil <gheil@rtimeinc.com>
Subject: Re: compiling perl for irix6.2
Message-Id: <33208C1E.7839@pms110.pms.ford.com>
Greg,
What problem are you having? I just started down the same path
today. I am using irix_6_2 for the hints and accepting defaults
for everything else. I have been successful so far, but have
not built our add-on modules yet.
--
Mike Conley
work: mconley@ford.com
home: mconley@bigfoot.com
Greg Heil wrote:
>
> I am trying to install perl5003 on an SGI R10000
> box running irix6.2 w/o luck. I have specified irix_6_2
> in the config process. I can supply the output of the
> make and the config.sh...but i was hoping someone
> had found a fix for this. I have found similar problems
> with gnu sw and it was necesssary to pretend the OS
> was 5.3 to fix those (and do w/o 64 bit registers).
>
> My altavista search and CPAN search has come up empty.
>
> Please reply by email, our firewall aint news friendly.
>
> thanks in advance
>
> --
> Greg Heil
> mailto:gheil@rtimeinc.com WORK http://www.rtimeinc.com
> http://www.scn.org/tl/anvil/ HOME mailto:gheil@scn.org
------------------------------
Date: Fri, 07 Mar 1997 19:40:13 -0800
From: "$Bill Luebkert" <dbe@wgn.net>
To: ps940566@beta.ufsia.ac.be
Subject: Re: Creating NonExisting File with Perl
Message-Id: <3320DF9D.3E7E@wgn.net>
Arnout Symoens wrote:
>
> Following problem :
>
> I'm writing a little CGI in perl (works perfectly..). But one of the
> things I need is to create a none existing new file (a new one for
> each new user). I can't do this with the open command, which will die
> when I open a none existing file..
Maybe the server doesn't have permissions to write a file in the
directory you are running in (or creating the file in).
If so, change the directory permissions to allow write by the server.
chmod 777 dir
should do it. Also, I would make this a separate directory from
where you keep your scripts for security.
> Ok, how do I create a new file from within perl ? It's running on an
> UNIX server...Would this mean I have to send an UNIX command like ? If
> yes, what command ? I can't find one..
The Perl "open" command with a > in the filename (eg:
open (OUT, ">filename") or die "Error opening filename: $!\n";
should do it. If you don't want to write to it now, then just
close it "close OUT;"
> On the other hand..It's probably me, not noticing which powerfull
> command Perl has hidden somewhere for me to create a file ...
>
> Anyone can help me out with this one...Source (small) wouldl be
> appreciated..
CC: ps940566@beta.ufsia.ac.be
--
,-/- __ _ _ $Bill Luebkert
(_/ / ) // // DBE Collectibles
/ ) /--< o // // http://www.wgn.net/~dbe/
-/-' /___/_<_</_</_ Email: dbe@wgn.net
------------------------------
Date: Fri, 07 Mar 1997 19:48:26 -0800
From: Michael Stearns <mstearns@darkwing.uoregon.edu>
Subject: Help with installing and using libwww
Message-Id: <3320E18A.2D870BEC@darkwing.uoregon.edu>
I am trying to make a socket connection to an http server. I abandoned
my homespun beginner's script in favor of the libwww module but I fear I
am in a deeper hole now.
I am working on a multiuser UNIX system.
I installed libwww in my home directory - actually in
/~homedir/perlstuff/ - I assume this is ok.
I used Makefile.PL PREFIX=~/perlstuff/perl
Is this a mistake? I am concerned I should have put something else here,
but I didn't know what else to do.
I don't have the IO module (from the README, it appeared this needed to
be installed by the sysadmin) and thus I got the message:
robot/ua............Can't locate IO/Socket.pm in @INC at robot/ua.t line
3.
FAILED before any test output arrived
when running make test.
So now I have /~mstearns/perlstuff/libwww-perl-5.07.
I have looked at lib/LPW.pm, but in a script, like the one below, there
are many constructions that I'm not familiar with. I tried running the
script from my perlstuff directory, but it just hung.
# Create a user agent object
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);
# Create a request
my $req = new HTTP::Request POST =>
'http://www.perl.com/cgi-bin/BugGlimpse';
$req->content_type('application/x-www-form-urlencoded');
$req->content('match=www&errors=0');
# Pass request to the user agent and get a response back
my $res = $ua->request($req);
# Check the outcome of the response
if ($res->is_success) {
print $res->content;
} else {
print "Bad luck this time\n";
}
Is this what I want to be using to make a simple connection to an http
server?
Thanks for any help,
Michael Stearns
------------------------------
Date: Fri, 07 Mar 1997 01:19:06 GMT
From: me@home
Subject: how to install perl on Personal Web Server?
Message-Id: <331f6cc6.1385793@news.pla-net.net>
Anyone know how I can get perl to run with the Microsoft personal web
server? I have the win95 version and don't have any problems running
it from the command line, but I would like to test some CGI in a
"real" web mode.
Thanks in advance!
Steve Neel
sneel@pla-net.net
sneel@sandc.com
http://www.pla-net.net/~sneel
------------------------------
Date: Fri, 07 Mar 1997 20:17:47 -0500
From: pp000978@mindspring.com (Larry Prall)
Subject: Re: Initializing array contents to all zeros
Message-Id: <pp000978-ya023680000703972017470001@news.mindspring.com>
In article
<bvd8tfwn6r.fsf@remus.i-have-a-misconfigured-system-so-shoot-me>,
really_eliot@dg-rtp.dg.com_but_mangled_to_stop_junk_email wrote:
>I need to create a lot of arrays and initialize their elements to zero.
>I want to initialized them explicitly because I may well read various
>elements before writing them, and perl -w burps out many screenfuls of
>warnings about using uninitialized values.
>Since I generally create several arrays of the same size at the same time,
>I have written a routine that takes one size parameter, and references
>to one or more arrays. It is:
>
>sub InitializeArrays {
> my $size = shift @_;
> my $firstarray = shift @_;
> my $otherarray;
>
> $#$firstarray = $size - 1;
> foreach $index (0 .. ($size - 1)) {
> $firstarray -> [$index] = 0;
> }
>
> foreach $otherarray (@_) {
> $#$otherarray = $size - 1;
> @$otherarray = @$firstarray;
> }
>}
How about something like:
sub initialize_arrays {
my $size = shift;
foreach ( @_ ) {
@$_ = split //, '0' x $size;
}
}
(Can't stay away from those implicits...)
------------------------------
Date: Fri, 07 Mar 1997 17:19:11 -0800
From: Pratik Datta <pratik@pretzel.com>
Subject: is 'my' compile-time or run-time?
Message-Id: <3320BE8F.50E9@pretzel.com>
I can't understand how my works.
{
my $a=5;
print $a;
my $a=3;
print $a;
}
If 'my' were compile time, it wouldn't allow two my's in the same block.
The compiler does generate a warning, but accepts it. The second my
hides the first. (I could retrive the value of the first one by keeping
a reference). Does this mean that if I put my in a loop, it will keep on
allocating new space for it?
And in this code:
my $a=5;
print $a;
my $a=3 if 0;
print $a;
The second print is surprisingly neither a 3, nor a 5 !!
Where is the my variable stored? It is not really like an auto variable
of C, otherwise closures wouldn't work.
Can someone refer me a good book on Perl?
Thanks in advance.
Pratik
------------------------------
Date: 8 Mar 1997 02:39:42 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: is 'my' compile-time or run-time?
Message-Id: <slrn5i1k4u.qgh.dave@fast.thomases.com>
On Fri, 07 Mar 1997 17:19:11 -0800, Pratik Datta <pratik@pretzel.com> wrote:
> I can't understand how my works.
>
> {
> my $a=5;
> print $a;
>
> my $a=3;
> print $a;
> }
>
> If 'my' were compile time, it wouldn't allow two my's in the same block.
> The compiler does generate a warning, but accepts it. The second my
> hides the first. (I could retrive the value of the first one by keeping
> a reference). Does this mean that if I put my in a loop, it will keep on
> allocating new space for it?
dave[~ 20:31:46] perl -w
my $a = 3;
print $a;
my $a = 5;
"my" variable $a masks earlier declaration in same scope at - line 3.
print $a;
Looks pretty compile time-ish to me!
In answer to the second part, the values in a loop are lost _unless_
referenced, in which case they are kept:
# Time-stamp: <97/03/07 20:35:23 dave>
my @list;
for my $i (1..10) {
my $var = $i*$i;
push @list, \$var;
}
print join(', ', map { $$_ } @list), "\n";
--
_________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Fri, 07 Mar 1997 16:59:52 -0800
From: crusso@alink.net (Chris Russo)
Subject: Re: NDBM and flock
Message-Id: <crusso-0703971659520001@buzz.alink.net>
In article <pudge-ya02408000R0703971622230001@news.idt.net>,
pudge@pobox.com (Chris Nandor) wrote:
>In article <5fq04b$5m1$1@csnews.cs.colorado.edu>, tchrist@mox.perl.com (Tom
>Christiansen) wrote:
>
>#Use DB_File instead.
>
>DB_File isn't on all systems though, is it? I am programming for someone
>else and I cannot guarantee that their crappy system will have DB_File
>available. I will try to install it, but in case I cannot, let me ask
>again: Does anyobdy have a snippet of code for flock'ing an NDBM database?
>Is it possible, Tom?
Why not just lock a secondary file while you're in the database as a signal?
Chris Russo
----------------------------------------------------------------------
Chris Russo A-Link Network Services, Inc.
crusso@alink.net Bolo me
http://www.alink.net/~crusso
------------------------------
Date: Fri, 07 Mar 1997 23:44:00 +0000 (GMT)
From: Graham Cant <citadel@dircon.co.uk>
Subject: Newbie recursion question
Message-Id: <ant072300d07k5z&@citadel.dircon.co.uk>
I've just started learning Perl, and I'm trying to convert a simple
program from BASIC to Perl to run on a web page.
Can anyone tell me what is wrong with this piece of code:
open(DATA,'ADFS::HardDisc4.$.Perl.Data');
while(<DATA>) {
($a,$b,$c)=split(/,/);
$m{$a}=$b;
$f{$a}=$c;
}
close(DATA);
&tree($m{"1"},4);
&tree($f{"1"},4);
sub tree {
local($d,$e) = ($_[0],$_[1]);
print "called tree with $d,$e\n";
if ($e !=0) {
$e=$e-1;
&tree($m{$d},$e);
print "returned $d,$e\n";
&tree($f{$d},$e);
print "returned $d,$e\n";
}
}
My data is just a list like:
1,2,3
2,4,5
3,6,7
4,8,9 etc etc
I'm trying to make a depth first search, and although the code works fine
in BASIC, Perl hates it. I can't get it to transverse back up the tree!
On the way down to the first branch the code behaves as expected, but the
values I get on the way back are garbage.
Please someone help!
--
G.
Disclaimer: I regularly talk rubbish.
------------------------------
Date: 7 Mar 1997 22:29:18 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Opening files in subdirectories
Message-Id: <5fq4ru$9k7$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Chowder <q0c73@unb.ca> writes:
:I'm writing a script the will handle a number of files, which the script
:will create. I know it's a simple question but how do I open a file for
:output and specify which sub directory it is in. This will be used os a
:CGI script and I want to send certain files to certain directories. I am
:using the win32 port of perl 5.003.
:
:I tried
:
:open (file1, ">/stuff/$filename")
:
:but it didn't work.
:
:an e-mail response would be greatly appreciated as I will get it faster.
Using
or die "can't open /stuff/$filename: $!"
would be greatly appreciated because you would figure it out faster.
Um, you *did* read
http://www.perl.faq/perl/faq/idiots-guide.html
Didn't you?
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"SPARC" is "CRAPS" backwards --Rob Pike
------------------------------
Date: Fri, 07 Mar 1997 17:03:23 -0500
From: Mike Conley <mconley@pms110.pms.ford.com>
To: Ian Mortimer <mortimer@physics.uq.oz.au>
Subject: Re: Path problem.
Message-Id: <332090AB.495C@pms110.pms.ford.com>
Ian Mortimer wrote:
>
> Perl 5.003 is installed on our server under /usr/local. On some
> of our clients this is mounted under /usr/local/tools.
>
> I'm using this simple test program on the client:
>
> #!/usr/local/tools/bin/perl
> dbmopen(%verb, "TMP_verb",0755);
>
> It fails with this message:
>
> No dbm on this machine at tst line 2.
>
> So I did:
>
> export PERL5LIB=/usr/local/tools/lib/perl5
>
> and now it fails with:
>
> AnyDBM_File doesn't define a TIEHASH method at tst line 2
>
> Does anyone what know what else I need to set to get this to work?
> Any help greatly appreciated.
>
> Thanks
> Ian
I think you have to account for the entire @INC path in PERL5LIB.
something like
export PERL5LIB=/usr/local/tools/lib/perl5/PA-RISC1.1/5.003:
/usr/local/tools/lib/perl5: etc. for site_perl
(The PA-RISC1.1/5.003 comes from my HP-UX system, it will be different
for each platform. Look at the @INC printed by perl -V)
You need the platform specific directory to get the autoloaded
libraries where TIEHASH is defined.
--
Mike Conley
mconley@ford.com
------------------------------
Date: Fri, 7 Mar 1997 18:55:47 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl help required. Begginer :(
Message-Id: <jedqf5.hv4.ln@localhost>
Tom Holder (Tom@intermart.co.uk) wrote:
: Hi,
Hi.
: I'm after some help regarding Perl
That's what this newsgroup is here for.
: and CGI. I want to program my CGI
^^^^^^^
That's what some other newsgroup is there for.
(comp.infosystems.www.authoring.cgi)
: scripts in perl because I understand it's the done thing and it's also a
: requirement of my server so that decision was made quite easily.
: Unfortunately I don't have a clue about programming in Perl, I know a
: fair bit about C and am quite experienced in using PASCAL but I have
: never used an interpreted language which I understand Perl is. This
: worries me slightly to say the least.
No worries mate. Just one less step in the write program-run-debug
cycle (notice the absence of the beloved 'compile' in the cycle ;-)
(actually the compile is in there as the first part of the 'run'
part. Perl is a 'compile and go' type of "interpreter")
People experienced with programming generally don't have too hard
of a time getting to know perl.
: I have very little in the way of funds being a student and would like to
: know if there is an idiots guide to perl and CGI on the web (I mean
^^^^^^^^^^^^^^^ ^^^
How fortuitous! There is indeed one for CGI programming.
: idiots! :) I've looked and couldn't find anything that helped.
Look at www.perl.com
: Also, where can I get Perl? I used to have it but it just seemed like a
: bunch of meaningless files without any kind of program, a bit daunting
^^^^^^^^^^^^^^^^^
Hrrrmph.
: and as I didn't 'need' to learn it that point I didn't, sadly now I do
: and would apreciate any help that you can give me on the subject.
Look at www.perl.com ;-)
Buying "Learning Perl" by Randal Schwartz would be a Really Good Thing.
( http://www.ora.com )
: What exaclty do I put in my CGI bin?
I dunno. Ask in the CGI newsgroup.
: Just the uncompiled program? How do
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Yep.
: you call it? I really need all my stupid/trivial questions answered.
^^^^^^^^^^^
Ask in the CGI newsgroup, again.
( on Unix servers, you just put a "shebang" line as the first line
of the file, with no leading spaces: #!/usr/bin/perl -w.
Don't forget that '-w' part on the end... )
: Please help me :(
Hope I did.
: I am using Win95 by the way if that has any bearing on the copy of perl
^^^^^^^^^^^
: I should use.
Too bad. Where's an ASCII art of a violin when you need it? ;-)
Of course, CGI scripts run on the _server_. So what you have at home
will only limit your development, not what is actually possible.
: Thanks for your time and any help you can offer me,
: P.S. Erm, anyone know of a Pascal > Perl converter? Nope? Thought not!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You already know the answer to that one, it would appear...
... in a few weeks it could be Tom Holder ;-)
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Fri, 7 Mar 1997 22:36:21 GMT
From: Chris Engel <cengel@oise.utoronto.ca>
Subject: Re: perl program works on command line, but not when run through www server
Message-Id: <Pine.SOL.3.91.970307173305.14159A-100000@tortoise>
Many apologies to those out there who saw this message posted 6 times (a
bit much). The use of Netscape's newsgroup thing and a twitchy mousepad
will be discontinued in favour of ye good auld keyboard. Also, thank you
to those who did respond (without flaming for duplicate posting). A few
CS students who looked at it were also puzzled why the thing didn't work
(we still can't figure that one out)
Many thanks!
Chris
On Thu, 6 Mar 1997, Chris Engel wrote:
> Date: Thu, 06 MAR 1997 04:56:41 -0400
> From: Chris Engel <cengel@nh1adm.uwaterloo.ca>
> Newgroups: comp.lang.perl.misc
> Subject: perl program works on command line, but not when run through www server
>
> 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: Fri, 07 Mar 1997 21:50:57 -0500
From: Ron & Mary Stephens <asdrs2@gte.net>
Subject: RAND/SRAND query
Message-Id: <3320D411.7D92@gte.net>
I'm writing a script which needs to generate several random
integers. Here's the problem which I hope someone will have
an answer to.
The first random number works fine. I call it using the standard
srand time () seed.
srand;
$numberone = int (rand ($range) + 1);
How then do I call a second random number that is truly random? So far
I've been using the first random number as the SRAND seed for the second
call, the second number for the third SRAND seed and so on. But this
only results in a pattern that isn't truly random. i.e. the first
number determines the second etc.
Any advice would be appreciated.
Dave Stephens
afrds2@microserve.net
------------------------------
Date: Fri, 7 Mar 1997 20:33:09 -0500
From: cctyner@eos.ncsu.edu (Chris Tyner)
Subject: Sybase Compile Problem
Message-Id: <MPG.d8a8bdc78848579989681@news.intrex.net>
I have bit of a problem trying to compile the Sybase 2.07 module
due to some missing lib files. I am working on Linux and was
wondering if someone can point me in the right direction to download
the files. Makefile.PL output is as follows:
/tmp/sybperl-2.07># perl Makefile.PL
Writing Makefile for Sybase::BCP
Warning (will try anyway): No library found for -ltli
Writing Makefile for Sybase::CTlib
Warning (will try anyway): No library found for -lsybdb
Warning (will try anyway): No library found for -ltli
Writing Makefile for Sybase::DBlib
Writing Makefile for Sybase::Sybperl
Writing Makefile for Sybase
Thanks,
Chris Tyner
------------------------------
Date: Fri, 7 Mar 1997 23:41:45 GMT
From: Keith Nakanishi <keith.k.nakanishi@boeing.com>
Subject: Which version of Perl do I have?
Message-Id: <3320A7B9.4494@boeing.com>
How do I determine which version of Perl that is running on our UNIX
system?
Keith
------------------------------
Date: 8 Mar 1997 00:41:16 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Which version of Perl do I have?
Message-Id: <5fqcjc$qap@fridge-nf0.shore.net>
Keith Nakanishi (keith.k.nakanishi@boeing.com) wrote:
: How do I determine which version of Perl that is running on our UNIX
: system?
perl -v perl -v hi ho the dairy-o perl -v!
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Fri, 7 Mar 1997 18:35:32 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Which version of Perl do I have?
Message-Id: <k8cqf5.ht4.ln@localhost>
Keith Nakanishi (keith.k.nakanishi@boeing.com) wrote:
: How do I determine which version of Perl that is running on our UNIX
: system?
ask it ;-)
perl -v
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 07 Mar 1997 17:19:25 -0800
From: Jeff Coffin <jeff@networkers.com>
Subject: Re: Which version of Perl do I have?
Message-Id: <m2bu8vch9e.fsf@networkers.com>
>>>>> "KN" == Keith Nakanishi <keith.k.nakanishi@boeing.com> writes:
KN> How do I determine which version of Perl that is running on our
KN> UNIX system?
man perl
then after you have read it, perl -v or perl -V if you discover that
it's perl5
-jeff
------------------------------
Date: Fri, 7 Mar 1997 18:27:29 -0500
From: Jay Tomlin <ltomlin@ucs.indiana.edu>
Subject: Re: Why are my rand() values so tiny?
Message-Id: <Pine.HPP.3.91.970307182638.21092A-100000@ezinfo.ucs.indiana.edu>
>From my original post:
> I even tried calling srand with seeds other than the default time(), such
> as $$ and even (time() ^ ($$ + ($$ << 15)), to no avail.
-jay
On 7 Mar 1997, Tom Christiansen wrote:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, Jay Tomlin <ltomlin@ucs.indiana.edu> writes:
> : srand;
> : for ($i=0; $i<5; $i++) { print rand(10), "\n"; }
> :
> :yielded this:
> :
> : 0.000113327987492085
>
> Did it ever occur to you to give srand an argument?
>
> --tom
> --
> Tom Christiansen tchrist@jhereg.perl.com
>
>
> I'm TRYING to be a back end! - --Andrew Hume
>
>
----------
Jay Tomlin
Office of Overseas Study, Indiana University
http://ezinfo.ucs.indiana.edu/~ltomlin
"When it speaks of music, language is lame." --George Steiner
------------------------------
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 73
************************************