[12104] in Perl-Users-Digest
Perl-Users Digest, Issue: 5704 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 17 18:07:18 1999
Date: Mon, 17 May 99 15:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 17 May 1999 Volume: 8 Number: 5704
Today's topics:
Re: *** What is wrong with this? *** (I R A Aggie)
Re: A Perl Script <jeromeo@atrieva.com>
Re: A Perl Script (Bart Lateur)
Re: A Perl Script <collin.starkweather@colorado.edu>
Re: A Perl Script <lone.wolf@net.ntl.com>
Re: A Perl Script <lone.wolf@net.ntl.com>
Re: A Perl Script <lone.wolf@net.ntl.com>
Re: A Perl Script <lone.wolf@net.ntl.com>
Re: A Perl Script <lone.wolf@net.ntl.com>
clearing the screnn <guapo@postnet.com>
Re: Error message when reading a file tcpeter@my-dejanews.com
Re: Error message when reading a file <latsharj@my-dejanews.com>
Re: Error message when reading a file garthwebb@my-dejanews.com
Re: Error message when reading a file tcpeter@my-dejanews.com
Re: Error message when reading a file <latsharj@my-dejanews.com>
free cgi hosting <tim.shapcott@NOSPAMvirgin.net>
GD and GIFgraph jwwilhit@my-dejanews.com
Re: getopts <jdporter@min.net>
Getting Netscape server login information (frank white)
Re: Hash arrays <aqumsieh@matrox.com>
Re: Hash arrays <aqumsieh@matrox.com>
Re: negative subscripts <juex@my-dejanews.com>
Re: New website *sigh* only 755 permission <webmaster@*nospam*mugomilk.freeserve.co.uk>
Newbie: Aligning Text in Output File <webmaster@*nospam*mugomilk.freeserve.co.uk>
Re: Occasional user (Bart Lateur)
Running a perl script from an applet (EXCHANGE:FITZ3:9D14)
Sorting my list... me@alistair.com
Re: Sorting my list... (Alastair)
Re: Strange file reading problem <dlent1@uic.edu>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 17 May 1999 20:48:53 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: *** What is wrong with this? ***
Message-Id: <slrn7k10aq.4h7.fl_aggie@thepentagon.com>
On Sat, 15 May 1999 00:48:36 -0600, Tim <bie@connect.ab.ca>, in
<373D18C4.4A8E@connect.ab.ca> wrote:
+ Please tell me what the error is that I can not find
I couldn't find one, syntactically speaking...and yes, I
even turned on the -w switch...
+ require "subparseform.lib";
But I don't have this, so I can't run it. Maybe this is the source
of your problem? what do your server's error logs say?
James
------------------------------
Date: Mon, 17 May 1999 13:00:57 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Lone Wolf <lone.wolf@net.ntl.com>
Subject: Re: A Perl Script
Message-Id: <37407579.573820BE@atrieva.com>
Lone Wolf wrote:
>
> Or could someone send me a "REALLY" simple .pl program that should run on
> any server, or is already tailored for my IIS server.
#!/usr/local/bin/perl -w
use strict;
print qq{Content-type: text/html\n\n};
print q{<HTML><HEAD></HEAD><BODY>};
while( my($key,$value) = each %ENV){
print qq{$key = $value<BR>\n};
}
print q{</BODY></HTML>};
HTH!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Mon, 17 May 1999 20:13:53 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: A Perl Script
Message-Id: <3741784a.1756885@news.skynet.be>
Lone Wolf wrote:
>Can someone explain to me WHY this will not run on my Microsoft IIS 4
>server?
>
>print "HTTP/1.0 200 OK\n\n";
Double newline indicates end of headers. BTW You don't need this line.
>print "Content-Type: text/html\n\n";
This is the only HTTP header you need to make it work.
HTH,
Bart.
------------------------------
Date: Mon, 17 May 1999 14:06:23 -0600
From: Collin Starkweather <collin.starkweather@colorado.edu>
Subject: Re: A Perl Script
Message-Id: <374076BF.16D6A82C@colorado.edu>
Microsoft likes no-parsed-headers.
Try this:
use CGI qw(-nph);
$cgi = new CGI;
print $cgi->header;
print <<"eop";
<HTML>
<HEAD>
<TITLE>Hello World</TITLE>
</HEAD>
<BODY>
<H4>Hello World</H4>
<P>
Your IP Address is $ENV{REMOTE_ADDR}.
</P>
<H5>Have a nice day</H5>
</BODY>
</HTML>
eop
The HTML file that calls the script:
<HTML>
<BODY>
<FORM ACTION="/scripts/test.pl">
<INPUT TYPE="SUBMIT">
</FORM>
</BODY>
</HTML>
This works on my NT box running MIIS.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Collin Starkweather (303) 492-4784
University of Colorado collin.starkweather@colorado.edu
Department of Economics http://ucsu.colorado.edu/~olsonco
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lone Wolf wrote:
>
> Or could someone send me a "REALLY" simple .pl program that should run on
> any server, or is already tailored for my IIS server.
>
> Thanks
>
> Lone Wolf wrote in message <3740587d.0@145.227.194.253>...
> >The books I have must be so full of rubbish :-
> >
> >Can someone explain to me WHY this will not run on my Microsoft IIS 4
> >server?
> >
> >print "HTTP/1.0 200 OK\n\n";
> >print "Content-Type: text/html\n\n";
> >print "<HTML>\n";
> >print "<HEAD>\n";
> >print "<TITLE>Hello World</TITLE>\n";
> >print "</HEAD>\n";
> >print "<BODY>\n";
> >print "<H4>Hello World</H4>\n";
> >print "<P>\n";
> >print "Your IP Address is $ENV{REMOTE_ADDR}.\n";
> >print "</P>\n";
> >print "<H5>Have a nice day</H5>\n";
> >print "</BODY>\n";
> >print "</HTML>\n";
> >
> >I keep getting the error message :-
> >CGI Error
> >The specified CGI application misbehaved by not returning a complete set of
> >HTTP headers. The headers it did return are:
> >
> >And thats all I get back.
> >
> >Thanks for shedding any light.
> >
> >
------------------------------
Date: Mon, 17 May 1999 22:23:20 +0100
From: "Lone Wolf" <lone.wolf@net.ntl.com>
Subject: Re: A Perl Script
Message-Id: <37407882.0@145.227.194.253>
Cool
Thanks for the quick reply.
Eric Bohlman wrote in message ...
>Lone Wolf <lone.wolf@net.ntl.com> wrote:
>: The books I have must be so full of rubbish :-
>
>: Can someone explain to me WHY this will not run on my Microsoft IIS 4
>: server?
>
>: print "HTTP/1.0 200 OK\n\n";
>
>That double newline marks the end of your headers.
>
>: print "Content-Type: text/html\n\n";
>
>Even though you aren't finished sending them
>: print "<HTML>\n";
>: print "<HEAD>\n";
>
>[snip]
>
>Take a look at perlop, in the section about quoting operators, and read
>up on "here documents" to learn a much more readable and maintainable way
>to do this sort of thing.
>
------------------------------
Date: Mon, 17 May 1999 22:31:43 +0100
From: "Lone Wolf" <lone.wolf@net.ntl.com>
Subject: Re: A Perl Script
Message-Id: <37407a79.0@145.227.194.253>
Umm. I still get the same error message. I must have a configuration
problem. Could you point it out what it maybe as I am going to build a
completly new server tomorow.
Thanks
Lone Wolf wrote in message <37407882.0@145.227.194.253>...
>Cool
>Thanks for the quick reply.
>
>
>Eric Bohlman wrote in message ...
>>Lone Wolf <lone.wolf@net.ntl.com> wrote:
>>: The books I have must be so full of rubbish :-
>>
>>: Can someone explain to me WHY this will not run on my Microsoft IIS 4
>>: server?
>>
>>: print "HTTP/1.0 200 OK\n\n";
>>
>>That double newline marks the end of your headers.
>>
>>: print "Content-Type: text/html\n\n";
>>
>>Even though you aren't finished sending them
>>: print "<HTML>\n";
>>: print "<HEAD>\n";
>>
>>[snip]
>>
>>Take a look at perlop, in the section about quoting operators, and read
>>up on "here documents" to learn a much more readable and maintainable way
>>to do this sort of thing.
>>
>
>
------------------------------
Date: Mon, 17 May 1999 22:33:13 +0100
From: "Lone Wolf" <lone.wolf@net.ntl.com>
Subject: Re: A Perl Script
Message-Id: <37407ad3.0@145.227.194.253>
Thanks for the help.
I tried the code but I still get the same error message again.
It has to be a configuration problem with the server can you suggest
anything as I have had enough and am going to rebuild the server tomorow.
Thanks
Collin Starkweather wrote in message <374076BF.16D6A82C@colorado.edu>...
>Microsoft likes no-parsed-headers.
>
>Try this:
>
>use CGI qw(-nph);
>$cgi = new CGI;
>print $cgi->header;
>print <<"eop";
><HTML>
><HEAD>
><TITLE>Hello World</TITLE>
></HEAD>
><BODY>
><H4>Hello World</H4>
><P>
>Your IP Address is $ENV{REMOTE_ADDR}.
></P>
><H5>Have a nice day</H5>
></BODY>
></HTML>
>eop
>
>The HTML file that calls the script:
>
><HTML>
><BODY>
><FORM ACTION="/scripts/test.pl">
><INPUT TYPE="SUBMIT">
></FORM>
></BODY>
></HTML>
>
>This works on my NT box running MIIS.
>
>--
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Collin Starkweather (303) 492-4784
>University of Colorado collin.starkweather@colorado.edu
>Department of Economics http://ucsu.colorado.edu/~olsonco
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>Lone Wolf wrote:
>>
>> Or could someone send me a "REALLY" simple .pl program that should run on
>> any server, or is already tailored for my IIS server.
>>
>> Thanks
>>
>> Lone Wolf wrote in message <3740587d.0@145.227.194.253>...
>> >The books I have must be so full of rubbish :-
>> >
>> >Can someone explain to me WHY this will not run on my Microsoft IIS 4
>> >server?
>> >
>> >print "HTTP/1.0 200 OK\n\n";
>> >print "Content-Type: text/html\n\n";
>> >print "<HTML>\n";
>> >print "<HEAD>\n";
>> >print "<TITLE>Hello World</TITLE>\n";
>> >print "</HEAD>\n";
>> >print "<BODY>\n";
>> >print "<H4>Hello World</H4>\n";
>> >print "<P>\n";
>> >print "Your IP Address is $ENV{REMOTE_ADDR}.\n";
>> >print "</P>\n";
>> >print "<H5>Have a nice day</H5>\n";
>> >print "</BODY>\n";
>> >print "</HTML>\n";
>> >
>> >I keep getting the error message :-
>> >CGI Error
>> >The specified CGI application misbehaved by not returning a complete set
of
>> >HTTP headers. The headers it did return are:
>> >
>> >And thats all I get back.
>> >
>> >Thanks for shedding any light.
>> >
>> >
------------------------------
Date: Mon, 17 May 1999 22:33:39 +0100
From: "Lone Wolf" <lone.wolf@net.ntl.com>
Subject: Re: A Perl Script
Message-Id: <37407aed.0@145.227.194.253>
Still get the same error message, Any suggestions before I rebuild the
server?
Bart Lateur wrote in message <3741784a.1756885@news.skynet.be>...
>Lone Wolf wrote:
>
>>Can someone explain to me WHY this will not run on my Microsoft IIS 4
>>server?
>>
>>print "HTTP/1.0 200 OK\n\n";
>
>Double newline indicates end of headers. BTW You don't need this line.
>
>>print "Content-Type: text/html\n\n";
>
>This is the only HTTP header you need to make it work.
>
> HTH,
> Bart.
------------------------------
Date: Mon, 17 May 1999 22:37:59 +0100
From: "Lone Wolf" <lone.wolf@net.ntl.com>
Subject: Re: A Perl Script
Message-Id: <37407bf0.0@145.227.194.253>
Still get the same error message, this has to be a server config problem.
Any suggestions?
Thanks
Jerome O'Neil wrote in message <37407579.573820BE@atrieva.com>...
>Lone Wolf wrote:
>>
>> Or could someone send me a "REALLY" simple .pl program that should run on
>> any server, or is already tailored for my IIS server.
>
>#!/usr/local/bin/perl -w
>use strict;
>
>print qq{Content-type: text/html\n\n};
>
>print q{<HTML><HEAD></HEAD><BODY>};
>
>while( my($key,$value) = each %ENV){
> print qq{$key = $value<BR>\n};
>}
>
>print q{</BODY></HTML>};
>
>
>HTH!
>
>--
>Jerome O'Neil, Operations and Information Services
>Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
>jeromeo@atrieva.com - Voice:206/749-2947
>The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Mon, 17 May 1999 16:42:25 -0500
From: "Gary Yerby" <guapo@postnet.com>
Subject: clearing the screnn
Message-Id: <Z5003.4426$S07.34562580@typhoon.stlnet.com>
does anyone know the statement to clear what the user sees on the screen so
as to have a nice clean screen for the next statement.
------------------------------
Date: Mon, 17 May 1999 19:50:31 GMT
From: tcpeter@my-dejanews.com
Subject: Re: Error message when reading a file
Message-Id: <7hpru6$uj4$1@nnrp1.deja.com>
So should it be something like:
opendir(DIR, $path);
while ( defined ($file = readdir(DIR) ) ) {
push(@files,$file);
}
for $filename (@files) {
local *FH;
open(FH,"$path/$filename") || die "Couldn't open
$filename : $!\n";
???
That gives the same error. Am I missing something really simple here?
Sorry if this posted twice, DejaNews logged me out.
In article <7hpmsc$qn7$1@nnrp1.deja.com>,
Dick Latshaw <latsharj@my-dejanews.com> wrote:
> Check the perlfunc entry for readdir. Particularly the comments
> about the example.
> --
> Regards,
> Dick
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
>
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Mon, 17 May 1999 20:21:57 GMT
From: Dick Latshaw <latsharj@my-dejanews.com>
Subject: Re: Error message when reading a file
Message-Id: <7hptp3$vsm$1@nnrp1.deja.com>
In article <7hpru6$uj4$1@nnrp1.deja.com>,
tcpeter@my-dejanews.com wrote:
> So should it be something like:
>
> opendir(DIR, $path);
> while ( defined ($file = readdir(DIR) ) ) {
> push(@files,$file);
> }
> for $filename (@files) {
> local *FH;
> open(FH,"$path/$filename") || die "Couldn't open
> $filename : $!\n";
Getting close - put this line after for $filename (@files) {
print $filename, "\n";
If you look really close you will see a '.'.
--
Regards,
Dick
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Mon, 17 May 1999 20:17:00 GMT
From: garthwebb@my-dejanews.com
Subject: Re: Error message when reading a file
Message-Id: <7hptfq$vim$1@nnrp1.deja.com>
Try replacing the line:
open(FH,"$path/$filename")...
with:
print "File = '$filename'\n";
and rerunning the script. If what you see doesn't make sense to you run
a 'ls -1a' (thats the number one) from the command line and notice the
similarity.
Garth
In article <7hpru6$uj4$1@nnrp1.deja.com>,
tcpeter@my-dejanews.com wrote:
> So should it be something like:
>
> opendir(DIR, $path);
> while ( defined ($file = readdir(DIR) ) ) {
> push(@files,$file);
> }
> for $filename (@files) {
> local *FH;
> open(FH,"$path/$filename") || die "Couldn't open
> $filename : $!\n";
>
> ???
>
> That gives the same error. Am I missing something really simple here?
>
> Sorry if this posted twice, DejaNews logged me out.
>
> In article <7hpmsc$qn7$1@nnrp1.deja.com>,
> Dick Latshaw <latsharj@my-dejanews.com> wrote:
>
> > Check the perlfunc entry for readdir. Particularly the comments
> > about the example.
> > --
> > Regards,
> > Dick
> >
> > --== Sent via Deja.com http://www.deja.com/ ==--
> > ---Share what you know. Learn what you don't.---
> >
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
>
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Mon, 17 May 1999 20:44:50 GMT
From: tcpeter@my-dejanews.com
Subject: Re: Error message when reading a file
Message-Id: <7hpv41$qa$1@nnrp1.deja.com>
And a '..' ! So the error is that I'm trying to read a directory as
though it were a file?!? *That's* what is giving me the error, right?
I'm assuming I need to filter that "filehandle" out before attempting
to read the contents of the files, correct?
Thanks so much for all the help thus far. I'm really starting to get
this (I think ;-)
In article <7hptp3$vsm$1@nnrp1.deja.com>,
Dick Latshaw <latsharj@my-dejanews.com> wrote:
> In article <7hpru6$uj4$1@nnrp1.deja.com>,
> tcpeter@my-dejanews.com wrote:
> > So should it be something like:
> >
> > opendir(DIR, $path);
> > while ( defined ($file = readdir(DIR) ) ) {
> > push(@files,$file);
> > }
> > for $filename (@files) {
> > local *FH;
> > open(FH,"$path/$filename") || die "Couldn't open
> > $filename : $!\n";
>
> Getting close - put this line after for $filename (@files) {
>
> print $filename, "\n";
>
> If you look really close you will see a '.'.
> --
> Regards,
> Dick
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---
>
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Mon, 17 May 1999 21:07:51 GMT
From: Dick Latshaw <latsharj@my-dejanews.com>
Subject: Re: Error message when reading a file
Message-Id: <7hq0f5$1pc$1@nnrp1.deja.com>
In article <7hpv41$qa$1@nnrp1.deja.com>,
tcpeter@my-dejanews.com wrote:
> And a '..' ! So the error is that I'm trying to read a directory as
> though it were a file?!? *That's* what is giving me the error, right?
> I'm assuming I need to filter that "filehandle" out before attempting
> to read the contents of the files, correct?
Correct! Readdir gives you a directory listing, including . , .., and
any subdirectories. Next take a look at: for my $filename (<*>) {
--
Regards,
Dick
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Mon, 17 May 1999 22:36:14 +0100
From: "Tim Shapcott" <tim.shapcott@NOSPAMvirgin.net>
Subject: free cgi hosting
Message-Id: <7hq260$f83$1@nclient5-gui.server.virgin.net>
Hi,
Does anyone know of anywhere that I can ftp my cgi's for free? My isp won't
host cgi scripts, which is where the site is located. I have found plenty of
people who will host their own scripts for you, but i can't find any that
will host my scripts. I really don't want to have to pay for the privilege
(i know i know), so any help would be appreciated.
Thanks
Tim Shapcott
------------------------------
Date: Mon, 17 May 1999 20:29:23 GMT
From: jwwilhit@my-dejanews.com
Subject: GD and GIFgraph
Message-Id: <7hpu70$8l$1@nnrp1.deja.com>
I'm using Perl v. 5005_02 on and SGI O2 running
IRIX 6.5.1 and I'm trying to use GIFgraph-1.10 along
with GD-1.19. I keep getting the following warning message when I try
and create a graph:
Bad free() ignored at/usr/share/lib/perl5/site_perl/GIFgraph/axestype.pm
line 119
I get the same warning when I run the "make test" command from within
the GD directory. The testing procedure then reports that all tests
passed.
I don't have a problem with this warning message when I run the script
outside of a web page. It becomes a problem when I run it from within a
web page because the warning message gets tossed back to the web page
and I get an illegal header message from my web server. I've tried
recompiling and reinstalling both GD and GIFgraph. No luck. Any help
would be greatly appreciated.
Thanks,
-Jason
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Mon, 17 May 1999 21:11:41 GMT
From: John Porter <jdporter@min.net>
Subject: Re: getopts
Message-Id: <7hq0mb$239$1@nnrp1.deja.com>
In article <7hpnjd$r7b$1@nnrp1.deja.com>,
bing-du@tamu.edu wrote:
> if (getopts('isu', \%opt) == 0) {
> print $usage_msg;
> exit 1;
> }
>
> Can anybody tell me what the following getopts function does? Thank
> you? ('i','s','u' are options). 'perldoc -f getopts' told me No
> documentation for perl function `getopts' found
That's because it's not built in. It's in the module Getopt::Std.
perldoc Getopt::Std
--
John Porter
Put it on a plate, son. You'll enjoy it more.
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Mon, 17 May 1999 13:36:58 -0700
From: frank_white@berlex.com (frank white)
Subject: Getting Netscape server login information
Message-Id: <MPG.11a3a39d3be2c25c989681@news>
I have an intranet site running on Netscape Enterprise server 3.5.1 on a
Solaris system. I'm using perl CGI scripts to run programs from various
pages on the site. What I need to do is get the user's login name from
the server logs so I can save the results from the programs run by the
CGI scripts into directories under that user's home directory. I'm not
the sysadmin for the machine, and I have no previous experience dealing
with the server logs, and, unfortunately, he has no idea how to do
this.... help! :)
Thanks!
Frank White
frank_white-at-berlex-dot-com
------------------------------
Date: Mon, 17 May 1999 15:53:59 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Hash arrays
Message-Id: <x3yhfpbtqug.fsf@tigre.matrox.com>
armchair@my-dejanews.com writes:
>
> In article <373cf788@cs.colorado.edu>,
> tchrist@mox.perl.com (Tom Christiansen) wrote:
> > [courtesy cc of this posting sent to cited author via email]
> >
> > In comp.lang.perl.misc,
> > armchair@my-dejanews.com writes:
> > :if the hash has elements:
> > :$num_elements = entries(%hash);
> >
> > READ
> > THE
> > FUCKING
> > MANUAL
>
> You said that before. What is it? Do you just keep hitting the send key?
No .. it seems that you just don't understand what RTFM means. Or
maybe you're too lazy to do it. Just to give you a clue, from
'perlfunc':
if (%a_hash) { print "hash has members\n" }
Do you get it now?
HTH,
Ala
------------------------------
Date: Mon, 17 May 1999 16:14:45 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Hash arrays
Message-Id: <x3yg14vtpvv.fsf@tigre.matrox.com>
armchair@my-dejanews.com writes:
> Thanks Sam. My "manual" is "Perl From the Ground Up" by Michael
> McMillan, and it leaves off the (In a scalar context, returns the
> number of keys).
Haven't read this one. Can't comment on it, but you should start
looking at O'Reilly books.
> But I probably would not have understood the "scalar
> context" part without an example. I certainly hope that my $scalar =
> @array; and my $scalar = keys(%hash) just return some internal count and
> especially in the case of the second one, do not actually do an
> intermediate step of creating an anonymous array.
That is indeed the case. Hash Values (HVs) contain a special field
called xhv_keys, which contains the total number of hash entries. When
you call keys() in a scalar context, the number stored in xhv_keys is
returned. A similar variable, xav_arylen, exists for Array Values
(AVs).
Let me give you a point of advice. If you think that a feature is
missing in Perl, investigate it first, before you start criticizing
the language. If, after reading the FAQs and a lot of documentation
(and, dare I say, the source code), you still think it is indeed
missing, then patches speak louder than posts.
HTH,
Ala
------------------------------
Date: Mon, 17 May 1999 13:24:37 -0700
From: "J|rgen Exner" <juex@my-dejanews.com>
Subject: Re: negative subscripts
Message-Id: <7hptpu$q4u@news.dns.microsoft.com>
Thomas Wade Vaughan <vaughan@well.com> wrote in message
news:7hpojf$3v0$1@its.hooked.net...
> A co-worker wanted to know if we could start the index of an array
> with a negative value. Initially I said no, but later thought of
Use a hash instead.
A hash is functionally the same as an array, except that the domain is not
fixed to a continous subset of the natural numbers starting at 0.
jue
--
J|rgen Exner
------------------------------
Date: Mon, 17 May 1999 21:54:48 +0100
From: "Mug-O-Milk" <webmaster@*nospam*mugomilk.freeserve.co.uk>
Subject: Re: New website *sigh* only 755 permission
Message-Id: <7hpvqm$2ij$1@news5.svr.pol.co.uk>
Yes, there is a good service that allows this :O)
www.hypermart.net
Offer 10MB Web Space - and the ability to run CGI's and have FrontPage
Extensions Installed, if you so wish. You can Chmod the files via FTP.
HTH
Paul Lewis
@mugomilk UK and Ireland
http://www.mugomilk.cc.st
------------------------------
Date: Mon, 17 May 1999 21:24:37 +0100
From: "Mug-O-Milk" <webmaster@*nospam*mugomilk.freeserve.co.uk>
Subject: Newbie: Aligning Text in Output File
Message-Id: <7hpu21$k3a$1@news7.svr.pol.co.uk>
I'm outputting IP addresses, dates and search criteria to a file (address
below)
http://mugomilk.hypermart.net/cgi-bin/search.txt
I can do it in Java, but what is the code that I could use to align the last
two columns (Search Words and Pages Found) without using TABs (\t), as there
is not a maximum length (or an average) amount of words / characters that
people can search for.
And, Second Question, What code would I need to extract a RANDOM 10
Questions (or Searches) (The Scalar is Named - $question) from the
datafile? - As what Ask Jeeves does when you can "view" what others are
searching for.
Thanks Very Much in Advance.
http://www.mugomilk.freeserve.co.uk
------------------------------
Date: Mon, 17 May 1999 20:03:40 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Occasional user
Message-Id: <3740749c.814702@news.skynet.be>
Andre Giroux wrote:
>The installation of perl added the following line to the autoexec.bat file :
> path "%path%;C:\Perl\bin;"
>I guess this would be adequate. Or is it ?
Yes, provided that you did at least one reboot since Perl was installed.
You can test it, in the DOS windows, by the command "path" (you'll see
if indeed it IS in there), and if "perl -v" responds properly, saying
what version it is, your perl installation probably is alright.
I took a quick glance at the script, and I noticed that it supports some
command line options, including "help". That should get you on your way.
A simple "perl epstopdf -help" gave me the explanation for the command
line switches.
BTW the script seems to need Ghostscript as well. Do you have THAT
installed?
Bart.
------------------------------
Date: Mon, 17 May 1999 17:01:30 -0400
From: "Denley, Jake (EXCHANGE:FITZ3:9D14)" <denley@americasm01.nt.com>
Subject: Running a perl script from an applet
Message-Id: <374083AA.CB44409@americasm01.nt.com>
I have a perl script that I want to call from my Java applet. The
script takes two parameters, which I would like to pass from the
applet. Is it possible to run a perl execuatable from the applet? The
script will simply create a file which I will be using later on in the
applet.
Is this possible and if so how is it done?
Jake Denley
jaked@comnet.ca
------------------------------
Date: Mon, 17 May 1999 20:40:32 GMT
From: me@alistair.com
Subject: Sorting my list...
Message-Id: <7hpus0$og$1@nnrp1.deja.com>
Sorry if this got posted twice...new at DejaNews too.
I am trying to properly sort a list of browsers that have been to my
site. I am a newbie at this type of Perl function and I'm not sure how
to go about it.
I have a list of about 100 browser visits that make up around 8-10
different browsers. I'd like to read that list and print the results
sorted by number of times X browser hit the site.
How would I go about doing this? You can see the list at my website:
http://www.alistair.com
Any help would be appreciated.
Alistair Calder
--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---
------------------------------
Date: Mon, 17 May 1999 21:25:58 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Sorting my list...
Message-Id: <slrn7k15u2.5j.alastair@calliope.demon.co.uk>
me@alistair.com <me@alistair.com> wrote:
>Sorry if this got posted twice...new at DejaNews too.
>
>I am trying to properly sort a list of browsers that have been to my
>site. I am a newbie at this type of Perl function and I'm not sure how
>to go about it.
>
>I have a list of about 100 browser visits that make up around 8-10
>different browsers. I'd like to read that list and print the results
>sorted by number of times X browser hit the site.
Use a hash. As keys, use the 'browser' string and just increment values to keep
a count i.e.
$browsers{$1}++;
(assuming '$1' contains the 'browser' field from the file.
Use 'sort' in a standard way to sort the hash on keys (or values).
HTH.
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: Mon, 17 May 1999 15:09:56 -0500
From: David Lent <dlent1@uic.edu>
Subject: Re: Strange file reading problem
Message-Id: <37407794.2507@uic.edu>
Yep it's Netscape Newsreader. Thanks for your help I know what I was doing wrong now.
David L. Cassell wrote:
>
> @vars = <INFILE> #list context, reads whole file into @vars
>
> vs.:
>
> $var = <INFILE>; #reads one line in, i.e. the *next* line
>
> Now what happens if you combine these in one program?
> This is actually a fairly common beginner mistake.
>
> $line1 = <INFILE>; #got the first line only
> print <INFILE>; # prints out lines 2 through n
>
> because print() takes a *list*. The compiler looks at
> your codes, sees that you want list context, and puts
> the <> operator into list context.
>
> So.. you told Perl to read in one line, then print the
> rest. We're still working on the DWIM compiler. :-)
>
> Although you'll find that sometimes Perl does more DWIM
> than you wanted it to. :-)
>
> HTH,
> David
> --
> David Cassell, OAO cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5704
**************************************