[9198] in Perl-Users-Digest
Perl-Users Digest, Issue: 2817 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 5 12:07:13 1998
Date: Fri, 5 Jun 98 09:00:25 -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 Fri, 5 Jun 1998 Volume: 8 Number: 2817
Today's topics:
Announce: Emacs lisp TinyPe.rl.el (cont'd) (Jari Aalto+mail.perl)
ANNOUNCE: Emacs lisp TinyPerl.el plug-in module (POD mo (Jari Aalto+mail.perl)
bug? comments inside regex can't have '/' <xuming@email.unc.edu>
Re: Calling a Java scipt from perl <quednauf@nortel.co.uk>
Re: Couple of Newbie Questions scott@softbase.com
Re: Couple of Newbie Questions <Dave.Cross@gb.swissbank.com>
Re: How do you identify the OS <jdporter@min.net>
Re: HTML to PERL translation Conversion ptimmins@netserv.unmc.edu
Re: HTML to PERL translation Conversion <Dave.Cross@gb.swissbank.com>
I'm having problems: (Chris Reynolds)
Re: problem using LWP (Brad Murray)
Re: Q: apply func to mutate list; oneliner (Jonathan Stowe)
Re: regexp: Validating UPC Codes <jdporter@min.net>
Re: Spider programms in PERL <tchrist@mox.perl.com>
Re: Use of HTML, POD, etc in Usenet (was: Re: map in vo (Tom Grydeland)
Re: Web Error Log Analysis <ernst@eucanect.com>
Re: Why is there no "in" operator in Perl? (Leslie Mikesell)
Re: Why is there no "in" operator in Perl? (Abigail)
Re: Why is there no "in" operator in Perl? <tchrist@mox.perl.com>
Re: Why is there no "in" operator in Perl? (Mike Stok)
Re: Why is there no "in" operator in Perl? (Glen Koundry)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 05 Jun 1998 18:42:51 +0300
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Announce: Emacs lisp TinyPe.rl.el (cont'd)
Message-Id: <tbbts7g8hw.fsf@blue.sea.net>
..and here are the missing download instruction for Tinyperl
jari
Packages needed ftp://cs.uta.fi/pub/ssjaaa/
[package]
tinyperl.el
[lisp libraries needed]
tinylibb.el
tinylibm.el
tinylib.el
[other packages needed]
tinyurl.el
An additional package tinyurl.el is also need to enable
jumping to pod page references like "See perlfunc manpage".
This package also handles many different URL pointers, including
programming code (lisp Perl C/C++ currently) and regular
ftp:// and http:// pointers.
tinycompile.el
This module is not needed if you don't use "grep" feature.
------------------------------
Date: 05 Jun 1998 18:40:20 +0300
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: ANNOUNCE: Emacs lisp TinyPerl.el plug-in module (POD mode)
Message-Id: <tbemx3g8m3.fsf@blue.sea.net>
--Multipart_Fri_Jun__5_18:40:19_1998-1
Content-Type: text/plain; charset=US-ASCII
This is announcement of v1.19 Emacs package tinyperl.el
If you don't know what is Emacs, check
http://www.gnu.org/software/emacs/emacs.html
More links on the page
ftp://cs.uta.fi/pub/ssjaaa/elisp.html
The documentation of the module is attached below.
Cheers!
jari
--Multipart_Fri_Jun__5_18:40:19_1998-1
Content-Type: text/plain; charset=US-ASCII
Tinyperl.el -- Grabbag of Perl related utilities. Pod documentation
Preface, march 1998
I had introduced myself top perl 1994 and made some small and
intermediate big perl 4 libraries. But then there was a long
period when I saw Perl 5 conquering the Perl community and I
didn't have a chance to lern new Object and Reference technologies
that were added to the language. Now, 1998 I returned to the Perl
business and started converting all my programs to take advantage
of Perl 5.004_04 features.
As a result I needed some additional Emacs functions to keep my
Perl work going: Mostly this module offers POD page viewing commands.
Overview of features
o Instant function help: See documentation of `shift', `pop'...
o Show Perl manual pages in *pod* buffer
o Load source code into Emacs, like Devel::DProf.pm
o Grep through all Perl manpages (.pod)
o Follow POD manpage references to next pod page with TinyUrl
o Coloured pod pages with `font-lock'
o Separate `tiperl-pod-view-mode' for jumping topics and pages
forward and backward in *pod* buffer.
Package startup
At package startup the perl binary's `tiperl-:perl-bin'
@INC content is cached. If you have Modules somewhere else than
the standard @INC, then add additional `-I' swithes to the
`tiperl-:inc-path-switches' so that these additional paths are
cached too.
Also the Perl POD manual page path is cached at startup.
This is derived from Config.pm module $Config{privlib}.
If you need to change any of these during the sessions, reload
the package or call `tiperl-install' to update the changed values.
POD view mode: navigating in pod page and following urls
When pod is loaded to buffer, another package TinyUrl is turned on.
It can track several different kind of URLs, including perl pod
manpages for references like
See perlfunc manpage
^^^^^^^^^^^^^^^^
See [perltoc]
^^^^^^^^^
Devel::Dprof manpage
^^^^^^^^^^^^^^^^^^^^
You can click on the point to jump to the referenced pod page. Wait
couple of seconds on the current line that has any of there
reference and the URLs found are marked. If you don't want to use
TinyUrl package, add this setup after TinyPerl package has been
loaded
(add-hook tiperl-:load-hook 'my-tiperl-:load-hook)
(defun my-tiperl-:load-hook ()
"My TinyPerl customisations."
(remove-hook 'tiperl-:pod2text-after-hook 'turn-on-tiurl-mode-1)
)
In *pod* buffer where the pod ducumentation is shoved, an additional
browsing mode `tiperl-pod-view-mode' is turned to help moving around
topics:
;; moving down/up topics
PgDown tiperl-pod-view-heading-forward
PgDown tiperl-pod-view-heading-backward
;; Moving down/up one pod page at a time
;; The pod pages are all gatehered to single buffer *pod*
S-PgDown tiperl-pod-view-forward
S-PgUp tiperl-pod-view-backward
;; The normal PgUp/Down command is avalilable here
C-PgDown scroll-up
C-PgUp scroll-down
Perl Minor Mode description
Turning on `tiperl-mode' in any buffer gives you commands commands
to retrieve POD pages. This is most usefull with the programming
mode `perl-mode' (It is added to perl-mode-hook by default):
C-c ' f tiperl-pod-find-file
C-c ' P tiperl-pod-by-module
C-c ' p tiperl-pod-by-manpage
C-c ' k tiperl-pod-kill-buffers
C-c ' m tiperl-module-find-file
C-c ' d tiperl-perldoc
C-c ' g tiperl-pod-grep
o `tiperl-pod-find-file'
run pod2text over file pointed by the function
o `tiperl-pod-by-module'
Complete the installed Perl modules, like "Getopt::Long"
and run pod2text
o `tiperl-pod-by-manpage'
Complete Perl manual pages, like "perlfunc.pod" and run pod2text
o `tiperl-pod-kill-buffers'
Kill all *pod* buffers from Emacs
o `tiperl-module-find-file'
Complete installed module in @INC and load the file into Emacs.
Like giving name "Getopt::Long"
o `tiperl-perldoc' Uses perldoc -f to diplay documentation of
a perl function at point.
o `tiperl-pod-grep'
Grep regexp from all Perl POD manual pages. Answers to
our question "Is this discussed in FAQ".
--Multipart_Fri_Jun__5_18:40:19_1998-1--
------------------------------
Date: Fri, 05 Jun 1998 11:11:46 -0400
From: Xuming Wang <xuming@email.unc.edu>
Subject: bug? comments inside regex can't have '/'
Message-Id: <35780AB2.F3B03C1E@email.unc.edu>
I found I can't have '/' (or whatever character used for m//, s///) in the
comments:
$foo =~ /a # a test /
test/x;
or
$foo =~ m{a # test }
test}x;
gives compilation error:
Bareword found where operator expected at edit1.pl line 2, near "test"
(Missing semicolon on previous line?)
syntax error at edit1.pl line 2, near "test"
Execution of edit1.pl aborted due to compilation errors.
perl thinks the '/' in comment is the end of regex.
is this a bug or I missed something?
--
Xuming Wang
------------------------------
Date: Fri, 05 Jun 1998 15:49:34 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Calling a Java scipt from perl
Message-Id: <3578057E.1C666155@nortel.co.uk>
Eadmund@writeme.com wrote:
> Hi all,
>
> I Know it's probably a simple thing to do , but, could someone please give me
> an example of a piece of Perl script that generates a html output including a
> java script which will then run; this is what I have now, and it does'nt
> work!!
>
> sub HTMLPrintRegisterSuccess {
> local($main_script, $form_tags) =
> @_;
> print <<__END_OF_REGISTER_SUCCESS__;
You don't seem to tell the content-type to the browser. Why not use CGI.pm?
http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html
CGI offers good support for setting cookies, applying onchange, etc. events,
putting scripts into the <head>, etc.x3...
COPIED STRAIGHT FROM THE DOC:
print $q->startform(-onSubmit=>"validateMe(this)");
$JSCRIPT=<<END;
// Ask a silly question
function riddle_me_this() {
var r = prompt("What walks on four legs in the morning, " +
"two legs in the afternoon, " +
"and three legs in the evening?");
response(r);
}
// Get a silly answer
function response(answer) {
if (answer == "man")
alert("Right you are!");
else
alert("Wrong! Guess again.");
}
END
print $query->start_html(-title=>'The Riddle of the Sphinx',
-script=>$JSCRIPT);
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: 5 Jun 1998 13:17:48 GMT
From: scott@softbase.com
Subject: Re: Couple of Newbie Questions
Message-Id: <6l8r5s$8i5$2@mainsrv.main.nc.us>
disney7@mindspring.com wrote:
> 1) How can you pull a Linux shell variable into a Perl program?
I didn't realize Linux had *a* shell -- I thought it supported
the five or so common UNIX ones.
> There must be a way to pull the variable straight in.
The way to do it is to put the variable into the environment,
either by exporting it in sh-ish shells, or setenving it
in csh-ish shells.
> 2) How can you make Perl default to looking for files in the
> directory the script was run from.
chdir should do it. To answer your next question, no there is no
built-in way to know what the directory is where the script
started.
Most of the time, for cron jobs and the like, I wrap the perl
script in a shell script wrapper that changes to the proper
directory first, and then calls the perl script.
Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: Fri, 5 Jun 1998 14:35:49 GMT
From: David Cross-cmt <Dave.Cross@gb.swissbank.com>
Subject: Re: Couple of Newbie Questions
Message-Id: <eq04sxzapbu.fsf@gb.swissbank.com>
disney7@mindspring.com writes:
> 1) How can you pull a Linux shell variable into a Perl program?
> Right now I am having to:
> echo $4 >file.txt
> before running the perl script and then open and read file.txt
> from the Perl script. I tried just using $4 from within Perl,
> but it isn't the same variable as it is reported as undefined.
> There must be a way to pull the variable straight in.
Shell environments variables are available via the %ENV hash. This
is all made very clear in the fine Perl documentation.
> 2) How can you make Perl default to looking for files in the
> directory the script was run from. I have to use complete
> pathnames (ie. /etc/ppp/output.txt), if I don't the file
> will end up in the root directory. I'm not sure if this
> happens when run by hand... but it does if the perl script
> is executed by the system (from within ip-up, cron, etc.)
Perl uses the directory that was current when the script was started.
If you're running from cron, that will be the crontab owner's home
directory. If you want it to use a different directory then use
chdir to go there.
hth,
Dave...
--
If I wasn't so busy writing status reports,
my status report might just become a progress report.
Dave.Cross@gb.swissbank.com
------------------------------
Date: Fri, 05 Jun 1998 15:27:25 GMT
From: John Porter <jdporter@min.net>
Subject: Re: How do you identify the OS
Message-Id: <35780FFC.5C63@min.net>
Phil Taylor wrote:
>
> There is a chunk of code at the start of CGI.pm which does this and I
> have copied it into a procedure (see below), but Perl doesn't seem to
> like the code inside a procedure declaration. It works fine in the
> main body of the program.
>
> # -----
> proc os
> # -----
> {
s/procedure/subroutine/g;
s/proc/sub/g;
hth,
John Porter
------------------------------
Date: Fri, 05 Jun 1998 14:58:02 GMT
From: ptimmins@netserv.unmc.edu
Subject: Re: HTML to PERL translation Conversion
Message-Id: <6l911q$t$1@nnrp1.dejanews.com>
In article <6l8pjv$m3a$1@nnrp1.dejanews.com>,
Eadmund@writeme.com wrote:
>
> Hi all,
>
> I'm a bit of a newbie with regard to Perl, HTML, Newsgroups so please don't
> flame me if I'm asking a stupid question or posing it to the wrong
newsgroup.
>
> I have put together some pretty daunting web pages using notepad and MS-
> Frontpage. I now want (for various reasons) to have a Perl script generate
> the same HTML code with various forms etc filled in by my web server. I know
> that the filling in the data bit will have to be coded in to Perl script by
> hand, but....
>
> MY QUESTION: Is there a program/tool that will convert an HTML page into
perl
> script automatically, to remove the greater part of the donkey work?
>
> If anyone can help - please e-mail me at Eadmund@writeme.com
>
> Ta
> Ed.
I don't know that I understand your question. If you have a large web site,
the structure of your site/pages and the content of those pages are two
different things (if you want it to be maintainable in a cost efficient
matter). You should put your content in a database and the "structure
parameters" of your site in a database. Then use Perl (or something else) to
pull the data content out of the content database and format it into html by
the parameters set in your structure parameters database. If you cannot do
this, you need to learn how, or hire someone who already can.
Having said that, if you want to have a perl script send back the contents of
an existing web page to someone through your web cgi, then use
print "Location:http://your.web.domain/the_file_in_question.html\n";
in your perl script.
Patrick Timmins
U. Nebraska Medical Center
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 5 Jun 1998 14:03:06 GMT
From: David Cross-cmt <Dave.Cross@gb.swissbank.com>
Subject: Re: HTML to PERL translation Conversion
Message-Id: <eq067ig9c9x.fsf@gb.swissbank.com>
A Perl program that will generate a Perl program to reproduce a HTML
page.
--------------------------------------------------------------
#!/usr/local/bin/perl -w
# Given a filename, x, this script will open x.html and write
# a file called x.pl which, when run, will output the original
# HTML.
use strict;
scalar @ARGV || die "Usage: $0 <file>\n";
my $file = shift;
open(IN, "$file.html") || die "Can\'t open $file.html: $!\n";
open(OUT, ">$file.pl") || die "Can\'t open $file.pl: $!\n";
print OUT "#!/usr/local/bin/perl -w\n\n";
print OUT "use strict;\n";
print OUT "print <<\"END\";\n";
while (<IN>)
{
print OUT $_;
}
print OUT "END\n";
-------------------------------------------------------------
hth,
Dave...
Eadmund@writeme.com writes:
> I'm a bit of a newbie with regard to Perl, HTML, Newsgroups so please don't
> flame me if I'm asking a stupid question or posing it to the wrong newsgroup.
>
> I have put together some pretty daunting web pages using notepad and MS-
> Frontpage. I now want (for various reasons) to have a Perl script generate
> the same HTML code with various forms etc filled in by my web server. I know
> that the filling in the data bit will have to be coded in to Perl script by
> hand, but....
>
> MY QUESTION: Is there a program/tool that will convert an HTML page into perl
> script automatically, to remove the greater part of the donkey work?
>
> If anyone can help - please e-mail me at Eadmund@writeme.com
--
If I wasn't so busy writing status reports,
my status report might just become a progress report.
Dave.Cross@gb.swissbank.com
------------------------------
Date: Fri, 05 Jun 1998 02:50:40 GMT
From: cmreynolds@hotmail.com (Chris Reynolds)
Subject: I'm having problems:
Message-Id: <35775ceb.44456660@news.sprint.ca>
Can anyone help me: I am trying to do the following and am having a
really hard time doing it.
I am trying to write a Perl script called di that will provide summary
information on a directory and its sub-directories. I am looking to
make the script take a single directory as input parameter,
and compute and display the following infor for that directory and for
each of is sub-directories (and so on...):
The number of sub-directories
The number of ordinary files
The number of special files (e.g., symbolic links, sockets,
pipes, block & character device files)
The size, in kilobytes, of all files, directories, and special
files in the directory. Yes, directories and special files
have sizes too!
This is basically what I would like the output of a directory somedir
which has sub-directories subdir1 and subdir2, and where sub-directory
subdir2 has sub-directories subsubdir1 and subsubdir2, with subsubdir2
unreadable due to file permission restrictions.
% di dir1
/home/someuser/somedir/subdir1:
sub-directories: 0 (0)
ordinary files: 3 (3)
special files: 0 (0)
space consumed: 3263 (3263)
/home/someuser/somedir/subdir2/subsubdir1:
sub-directories: 0 (0)
ordinary files: 4 (4)
special files: 0 (0)
space consumed: 55759 (55759)
/home/someuser/somedir/subdir2/subsubdir2: UNREADABLE
/home/someuser/somedir/subdir2:
sub-directories: 2 (2)
ordinary files: 4 (8)
special files: 0 (0)
space consumed: 1612 (57371)
/home/someuser/somedir:
sub-directories: 2 (4)
ordinary files: 4 (15)
special files: 1 (1)
space consumed: 15888 (76522)
%
I'd also like so that if the script is not provided exactly one input
parameter or that parameter is a not a directory, a Usage message is
displayed on the line immediately below the command line and the
script terminate, as in:
% di notADirectory
Usage: di directory
%
If anyone can help I would really appreciate it. Thank-you!
------------------------------
Date: 5 Jun 1998 07:29:21 -0700
From: murrayb@vansel.alcatel.com (Brad Murray)
Subject: Re: problem using LWP
Message-Id: <6l8vc1$8iq@cadre2.vansel.alcatel.com>
It seems Tom Christiansen suggested [though his acid has been deleted]...
>In comp.lang.perl.misc, sylviamo@my-dejanews.com writes:
>:I'm using NT the Gurusamy Sarathy port of Perl.
>:I'm trying to use LWP simple.
>:I run this, which I got directly from somebody's post here
>:
>:D:\Projects\Tiger>perl -MLWP::Simple -e 'getprint "http://www.sn.no"'
>:Can't find string terminator "'" anywhere before EOF at -e line 1.
>
>You don't have a proper shell. I suggest you find one.
More usefully, as NT's command line does not provide the required degree
of quoting flexibility, you need to have perl do that for you:
perl -MLWP::Simple -e "getprint q$http://www.sn.no$"
There may be better choices than q$...$, but that one just appeared
off of the top of my head because I used it recently in a different
context.
Tom: not having Unix does not mean not having a solution. But only
because we at least have perl. :)
--
Brad Murray "The fall of modern man will be preceded by the
Software Analyst de-evolution of communications to the days of
Alcatel Canada oral tradition." --Tom Christiansen paraphrased
------------------------------
Date: Fri, 05 Jun 1998 15:21:52 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Q: apply func to mutate list; oneliner
Message-Id: <3577d355.93334546@news.btinternet.com>
On 05 Jun 1998 02:36:12 -0700, Xah Lee wrote :
>
>
>Suppose I have a list from split(...), then I want to apply a function to the second element, then return the list. How to do it in one line?
>
>Here's an *example*, where I'm using a @temp temporary array to achieve what I want.
>
>#!perl -w
>use strict;
>
>my $line='1998/Mar/01';
>my @temp; # I want to avoid this.
>
>sub monthNameToNumber {return '03'};
>
>@temp= split(m(/), $line);
>$temp[1]= monthNameToNumber($temp[1]);
>$line = join ('.',@temp);
>
>--
I'll trade you a temporary array for a temporary scalar:
#!perl -w
use strict;
my $line='1998/Mar/01';
my $line2 = $line;
my @temp; # I want to avoid this.
sub monthNameToNumber {return '03'};
@temp= split(m(/), $line);
$temp[1]= monthNameToNumber($temp[1]);
$line = join ('.',@temp);
print $line ,"\n";
my $i = 0;
$line2 = join '.',map {
if( $i == 1 )
{ $_ = monthNameToNumber($_); }
$i++;
$_ ;
} split(m(/), $line2);
print $line2,"\n";
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Fri, 05 Jun 1998 15:22:16 GMT
From: John Porter <jdporter@min.net>
Subject: Re: regexp: Validating UPC Codes
Message-Id: <35780EC2.513@min.net>
Here's another way, using eval:
$UPC = "063255878220"; # this is a known valid UPC code
{
$UPC =~ /^[067]\d{11}$/
or die "$UPC is not a 12-digit string starting with 0, 6, or 7";
my $upc = $UPC;
my $Check;
my $check_digit = chop $upc;
for ( reverse 1..10 ) { substr( $upc, $_, 0 ) = '+'; }
for ( reverse 0..5 ) { substr( $upc, 4*$_, 0 ) = '3*'; }
eval '$Check='.$upc;
(10 - $Check) % 10 == $check_digit or die "$UPC is not valid!\n";
}
warn "$UPC is valid!\n";
hth,
John Porter
------------------------------
Date: 5 Jun 1998 15:31:56 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Spider programms in PERL
Message-Id: <6l931c$49n$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Ala Qumsieh <aqumsieh@matrox.com> writes:
: Boy .. that is the longest sentence I've ever read!
Then you haven't read much of my writing. :-) I have a simple rule:
at the end of every paragraph, I place a period whether I'm ready for it
or not. It has been noted by others that my syntactic attention span is,
um, well, rather above average. :-)
--tom
Once prompted to describe the process that went into finishing
up the Turquoise Camel, here's the sentence I wrote in response:
``That reminds me of how I despite diligent and even prayer-filled
attempts to rid myself of such traumatic experiences to this very
day still recall in dreams sleeping and waking those interminably
long and bleary-eyed nights sequestered chez Larry in Mountain
View this past July during which I would cobble together tortuous
monstrosities of innumerable clauses and moods and styles and
dubious-at-best antecedents bereft of periods or even semi-colons,
chthonic monstrosities long since banished to the nethermost
depths of RCS purgatory whence they cry out in anguish and in
irrepentant shamelessness to be brought forth again to the light
of day and of my fellows so that others might with their own
disbelieving eyes see how very miserable were the aborted words
that a once-shimmering brain then laden with fatigue toxins was
nonetheless able to spew out, all the while blisslessly unaware
that those very words would cause not just Sharon and Gloria
but indeed the entire Wall household immured with us for the
duration to not once but rather on repeated occasions erupt in
fits and paroxyms of giggles and gaffaws while feigning learnhd
attempts at unravelling just what in tarnation I was in fact
trying to convey when I started those labyrinthine sentences so
painfully like this one.''
--
Perl itself is usually pretty good about telling you what you shouldn't do. :-)
--Larry Wall in <11091@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 5 Jun 1998 15:53:40 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: Use of HTML, POD, etc in Usenet (was: Re: map in void context regarded as evil - suggestion)
Message-Id: <slrn6ng544.6gv.Tom.Grydeland@mitra.phys.uit.no>
On 04 Jun 1998 13:56:25 -0400,
Rajappa Iyer <rsi@lucent.com> wrote:
> words. And where there's a compelling need for emphasis, Usenet has
> had conventions for a long time (e.g. *emphasis*, _emphasis or
> italics_, SHOUTING etc.) Again, just in case, the point is not clear:
> Usenet posts are ostensibly meant for human consumption; given that
> these humans are expected only to have a reader which displays ASCII,
> posts marked up with markup languages are rude, inconsiderate and
> anti-social. It's right up there with sending M$ Word documents as
> attachment.
Oh, please. Cool down a bit will you?9
There are well established conventions for emphasis, underlining, etc.
in Usenet posts. When I wanted to discuss Perl keywords as parts of a
normal sentence, none of those methods seemed obviously applicable. On
the EFnet channel #perl, putting code snippets in C< ... > is
well-established and useful, so I thought I'd use that for c.l.p.m as
well.
Notice that I did *not* use I<...>, B<...> =over, =item or anything
else that the usual conventions support.
As for having my humble C<map> comments rated as equivalent with
sending M$ Word documents as attachments, I guess that's just about
enough to invoke Godwin's law.
Can we now discuss the missing optimisation of C<map>, please?
> Rajappa Iyer <rsi@lucent.com> #include <std_disclaimer.h>
9 That comment was ment to all who have contributed to this discussion,
not just Rajappa Iyer.
--
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
- Do radioactive cats have 18 half-lives? -
------------------------------
Date: Fri, 05 Jun 1998 15:21:45 GMT
From: "Andrew Ernst" <ernst@eucanect.com>
Subject: Re: Web Error Log Analysis
Message-Id: <d2Ud1.8$Oo3.404324@sapphire.mtt.net>
You might want to try MKStats at http://www.mkstats.com. It is very easy to
configure, and is written in Perl.
-- Andrew
Andrew Ernst
W3 Internet Services Ltd.
http://www.w3internet.com
gdeering (NO#!%&SPAM) csu.edu.au (Geoff Deering) wrote in message
<3579711c.1047696608@newsagent.csu.edu.au>...
>Web Error Log Analysis
>
>There are plenty of utilities (and Perl scripts) to analyse standard
>web logs, but because error logs are in a different format, the ones I
>have tried cannot handle them. Does anyone have any perl scripts or
>utilities for this purpose (using Apache Servers)?
------------------------------
Date: 5 Jun 1998 10:19:12 -0500
From: les@MCS.COM (Leslie Mikesell)
Subject: Re: Why is there no "in" operator in Perl?
Message-Id: <6l929g$rc9$1@Mercury.mcs.net>
In article <6l8v3k$oqa$3@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
>
>As for the ordering of hashes, or rather, the lack thereof, I have never
>*once* found this to be a hardship. The workarounds are many, and easy,
>and they all take more time and space than a sort in the real cases
>(not the general computational complexity) that I have tested.
So what's the best idiom for blasting a list or array of names into
a hash with no associated values?
Les Mikesell
les@mcs.com
------------------------------
Date: 5 Jun 1998 15:17:37 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Why is there no "in" operator in Perl?
Message-Id: <6l926h$7of$2@client3.news.psi.net>
Michael J Gebis (gebis@albrecht.ecn.purdue.edu) wrote on MDCCXXXVIII
September MCMXCIII in <URL: news:6l6v7k$m2q@mozo.cc.purdue.edu>:
++ Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> writes:
++
++ }note, though, that grep is not restricted to regular expressions
++ }for testing, one can use an 'eq' test for improved performance:
++
++ If you care about performance, and your arrays are big, don't use a
++ linear search. Hash, baby, hash! (Please see tcgrep's post on this
++ for more copies of the word "HASH".)
Even if you have huge arrays, if you're searching only once, there's
no point in hashing, as building the hash table is linear too.
Abigail
--
perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'
------------------------------
Date: 5 Jun 1998 15:35:17 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why is there no "in" operator in Perl?
Message-Id: <6l937l$49n$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
les@MCS.COM (Leslie Mikesell) writes:
:So what's the best idiom for blasting a list or array of names into
:a hash with no associated values?
If you plan to test exclusively with exists, this is very cheap:
@hash{@array} = ();
If you plan to test boolean truth, as is more convenient, this
is what you wnat:
@hash{@array} = (1) x @array;
--tom
--
#define NULL 0 /* silly thing is, we don't even use this */
--Larry Wall in perl.c from the v4.0 perl source code
------------------------------
Date: 5 Jun 1998 16:46:10 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Why is there no "in" operator in Perl?
Message-Id: <6l97ci$l17@news-central.tiac.net>
In article <6l929g$rc9$1@Mercury.mcs.net>, Leslie Mikesell <les@MCS.COM> wrote:
>In article <6l8v3k$oqa$3@csnews.cs.colorado.edu>,
>Tom Christiansen <tchrist@mox.perl.com> wrote:
>>
>>As for the ordering of hashes, or rather, the lack thereof, I have never
>>*once* found this to be a hardship. The workarounds are many, and easy,
>>and they all take more time and space than a sort in the real cases
>>(not the general computational complexity) that I have tested.
>
>So what's the best idiom for blasting a list or array of names into
>a hash with no associated values?
What do you mean by "best", this works for me:
DB<1> @list = qw/sex sleep eat drink dream/
DB<2> @hash{@list} = ()
DB<3> X hahs
DB<4> X hash
%hash = (
'dream' => undef
'drink' => undef
'eat' => undef
'sex' => undef
'sleep' => undef
)
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Fri, 05 Jun 1998 15:50:43 GMT
From: glengk@mindspring.com (Glen Koundry)
Subject: Re: Why is there no "in" operator in Perl?
Message-Id: <35791316.180265498@news.mindspring.com>
On 4 Jun 1998 20:14:44 GMT, gebis@albrecht.ecn.purdue.edu (Michael J
Gebis) wrote:
>Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> writes:
>
>}note, though, that grep is not restricted to regular expressions
>}for testing, one can use an 'eq' test for improved performance:
>
>If you care about performance, and your arrays are big, don't use a
>linear search. Hash, baby, hash! (Please see tcgrep's post on this
>for more copies of the word "HASH".)
Actually the point to my question was not "what is the fastest way to
search a list?". I think an "in" operator would make the code a lot
easier to write (and to read as well).
Glen K
------------------------------
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 2817
**************************************