[13009] in Perl-Users-Digest
Perl-Users Digest, Issue: 419 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 8 11:06:27 1999
Date: Sun, 8 Aug 1999 08:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 8 Aug 1999 Volume: 9 Number: 419
Today's topics:
Re: a time to kill (Kevin Reid)
Re: a time to kill (Larry Rosler)
ASP_ActiveState_PerlScript under WinNT_iis3 is being "i <wrtl.brmpft@t-online.de>
capturing login and send passwd <creeds@sprint.ca>
Re: Checking if an URL is true or false ? <bruno.baguette@francemel.com>
Re: Checking if an URL is true or false ? (Abigail)
file manipulation? <tfiedler@ptd.net>
getting files from a user through the internet <help@xellent.co.uk>
How to protect perl script? jteens@my-deja.com
Re: How to protect perl script? (Graham Ashton)
Re: I guess this is a Misc question: Cgi-bin <newsgroup@bigwig.net>
Re: I guess this is a Misc question: Cgi-bin <newsgroup@bigwig.net>
Re: I guess this is a Misc question: Cgi-bin <flavell@mail.cern.ch>
Looking for Poll Script that... <jan@wilkening.net>
Re: Looking for Poll Script that... (Abigail)
LWP::Simple and URI::URL <newsgroups@justinfashanu.demon.co.uk>
Re: Newbie question about $_ <bowman@montana.com>
Re: Question about hashes. (Kevin Reid)
sed vs. grep for string manipulation? donturn@my-deja.com
Solved: extracting terminology from text <dpleic@close.open.hr>
Re: System call in Win NT, AS Build 518 <carvdawg@patriot.net>
What is webpluck??? <wilson33@hongkong.com>
Where to find help other than perldoc and books. <admin@futuristic.net>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 8 Aug 1999 09:42:49 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: a time to kill
Message-Id: <1dw6vb6.8iy7f416aoiucN@imac.loc>
Larry Rosler <lr@hpl.hp.com> wrote:
> , perhaps a better word would be bisyncratic. Don't look it up -- I just
> invented it, and it means just what I choose it to mean -- neither more
> nor less.
>
> Literary reference on that? (Not you, Tom -- it's too easy.)
Alice in Wonderland - Humpty Dumpty said it.
--
Kevin Reid: | Macintosh:
"I'm me." | Think different.
------------------------------
Date: Sun, 8 Aug 1999 07:39:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: a time to kill
Message-Id: <MPG.12173673d0c23654989e03@nntp.hpl.hp.com>
In article <1dw6vb6.8iy7f416aoiucN@imac.loc> on Sun, 8 Aug 1999 09:42:49
-0400, Kevin Reid <kpreid@ibm.net> says...
> Larry Rosler <lr@hpl.hp.com> wrote:
>
> > , perhaps a better word would be bisyncratic. Don't look it up -- I just
> > invented it, and it means just what I choose it to mean -- neither more
> > nor less.
> >
> > Literary reference on that? (Not you, Tom -- it's too easy.)
>
> Alice in Wonderland - Humpty Dumpty said it.
Wrong, but close - right.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 08 Aug 1999 16:00:23 +0200
From: Wrtl Brmpft <wrtl.brmpft@t-online.de>
Subject: ASP_ActiveState_PerlScript under WinNT_iis3 is being "ignored" !!! ???
Message-Id: <37AD8D77.9492800A@t-online.de>
Hi!
I'm using <ActiveStatePerl 5.005 Build 517" on an
WinNT-Server under IIS3, and have had no (serious)
problems when running "normal" CGI/PERL-Scripts
(up till now).
The last few days and nights I've been trying to
implement ActiveServerPages under the above setup, and
have also installed "WindowsScriptingHost 1.0". Having
extensively searched the WWW and Usenet-Newsgroups I've
the impression that everything is setup right, but the
result is, that I'm at the brink of hopelessness :-(((
The following ASP-PerlScript behaves as if there was
no PerlScript in it when accessed with a Browser via
Intranet.
If opened locally with WSH (WScript.exe) the error-msg is
<There is no script engine for file extension ".asp">
Changing the file-extension to ".pls" (see registry as
file attachment - comes from ActiveState-Setup/Install)
changes nothing in Browser/Intranet access, but results
in "senseless" syntax-error-messages when opened locally
with WSH (WScript.exe).
The Script is one of ActiveState's examples,
and all other examples "misbehave" just the same.
The ASCII-file-attachment “registry.txt” contains all
WinNT-Server-Registry entries that (I believe) could
have anything to do with my problem.
6 weeks ago I knew nothing of NT-Server, CGI, Perl etc.,
and have had to setup everything by myself up till now.
But now I'm clueless
Would be grateful for every hint.
======================================================= browser.asp
<%@ LANGUAGE = PerlScript%>
<HTML>
<HEAD>
<!--
Copyright (c) 1996, Microsoft Corporation. All rights reserved.
Developed by ActiveState Internet Corp., http://www.ActiveState.com
-->
<TITLE> Browser Capabilities </TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<!--
ActiveState PerlScript sample
PerlScript: The coolest way to program custom web solutions.
-->
<!-- Masthead -->
<TABLE CELLPADDING=3 BORDER=0 CELLSPACING=0>
<TR VALIGN=TOP ><TD WIDTH=400>
<A NAME="TOP"><IMG SRC="PSBWlogo.gif" WIDTH=400 HEIGHT=48 ALT="ActiveState PerlScript" BORDER=0></A><P>
</TD></TR></TABLE>
<%
$bc = $Server->CreateObject("MSWC.BrowserType");
sub tf($) {
return $_[0] ? 'True' : 'False';
}
%>
<H2>Browser Properties</H2><hr>
<TABLE BORDER=1>
<TR><TD>Browser Type</TD> <TD><%= $bc->browser %></TD>
<TR><TD>What Version</TD> <TD><%= $bc->Version %></TD>
<TR><TD>Major Version</TD> <TD><%= $bc->majorver %></TD>
<TR><TD>Minor Version</TD> <TD><%= $bc->minorver %></TD>
<TR><TD>Frames</TD> <TD><%= tf($bc->Frames) %></TD>
<TR><TD>Tables</TD> <TD><%= tf($bc->Tables) %></TD>
<TR><TD>Cookies</TD> <TD><%= tf($bc->cookies) %></TD>
<TR><TD>Background Sounds</TD> <TD><%= tf($bc->BackgroundSounds) %></TD>
<TR><TD>VBScript</TD> <TD><%= tf($bc->VBScript) %></TD>
<TR><TD>JavaScript</TD> <TD><%= tf($bc->Javascript) %></TD>
</TABLE>
</BODY>
</HTML>
=======================================================
------------------------------
Date: Sun, 08 Aug 1999 07:46:17 -0400
From: Carlos Reed <creeds@sprint.ca>
Subject: capturing login and send passwd
Message-Id: <37AD6E09.986B6A3C@sprint.ca>
Hi I'm planning to make a script to change the password for several
bay networks switches.
So I have to capture the login and then send the passwd.
I'm thinking to do it, with expect and perl.
Before reiventing the wheel.
a) I'm wonering, if someone has done such a script, somewhere in the
net.
b) Is there a perl module that acts like expect?
c) any sugestions will be welcomed.
Thanks, and have a nice day
Carlos Reed, from beautiful and lovely Quebec
------------------------------
Date: Sun, 08 Aug 1999 07:58:39 GMT
From: Bruno Baguette <bruno.baguette@francemel.com>
To: abigail@delanet.com
Subject: Re: Checking if an URL is true or false ?
Message-Id: <7ojdbd$a8n$1@nnrp1.deja.com>
>I'd say that if you think 204 is ``true'', 402 should be ``true''
>as well. And what about 101 or 30x? Or a 411?
204 : Indicate that the url have no content, so i think i have to
reject this URL...
402 : Payment Required, i should reject this url also...
1XX is not used currently.
30X : If it's 301 or 302, i go to this url and i test it...
411 : No authorization... I should reject the URL...
> !! And the other question is : Do you think my idea good
> !!to check the URL ?
>
> No.
Well ! So, what is your idea to check an URL ?
In fact, i would like to build a search engine for websites about
deafness, and i would like to check the URL like Altavista when a
visitor submit me an URL...
---------------------------------------------
Bruno BAGUETTE (bruno.baguette@francemel.com)
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 8 Aug 1999 03:19:33 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Checking if an URL is true or false ?
Message-Id: <slrn7qqfc7.1qe.abigail@alexandra.delanet.com>
Bruno Baguette (bruno.baguette@francemel.com) wrote on MMCLXVIII
September MCMXCIII in <URL:news:7ojdbd$a8n$1@nnrp1.deja.com>:
**
** >I'd say that if you think 204 is ``true'', 402 should be ``true''
** >as well. And what about 101 or 30x? Or a 411?
**
** 204 : Indicate that the url have no content, so i think i have to
** reject this URL...
But it's a valid URL....
** 402 : Payment Required, i should reject this url also...
But it's valid.... (though reserved for future use).
** 1XX is not used currently.
Says who? It's clearly documented in the RFC. Any unconditional server
or client has to know how to deal with this.
** 30X : If it's 301 or 302, i go to this url and i test it...
**
** 411 : No authorization... I should reject the URL...
Eh? 411: Length Required.
** > !! And the other question is : Do you think my idea good
** > !!to check the URL ?
** >
** > No.
**
** Well ! So, what is your idea to check an URL ?
It's about as possible as checking for 'valid' email addresses.
Abigail
--
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 08 Aug 1999 14:48:11 GMT
From: "ted fiedler" <tfiedler@ptd.net>
Subject: file manipulation?
Message-Id: <LMgr3.723$e34.70074@nnrp2.ptd.net>
I have a file which looks like this:
008
PAGE 1
015 JOHN DOE
1 1 CEDAR AVE.
1 SOMEWHERE PA 11111-0000
1 07/15/99 006056-1
10.00
2 80 1
027 08/12/98 EST PT. E/M LEVEL III 55.00 I: 29.22- 15.78-
10.00
1 5-1002 -CRS 99213 715.95 OFFICE
061 *** *** *** *** ***
2 .00 .00 .00 10.00 10.00
008
PAGE 1
015 JANE DOE
1 RD3 BOX 43
1 SOMEPLACE PA 12222-0000
1 07/15/99 010050-1
75.00
2 85S 2
027 04/23/98 EST PT. E/M LEVEL III 55.00 I: 30.49- 19.51-
5.00
1 5-1302 -CRS 99213 V67.0 OFFICE
1 07/27/98 EST PT. E/M LEVEL III 55.00 45.00-
10.00
1 5-1102 -CRS 99213 726.11 OFFICE
1 09/14/98 EST PT. E/M LEVEL III 55.00 I: 29.22- 15.78-
10.00
1 5-0902 -CRS 99213 V43.65 OFFICE
1 10/26/98 EST PT. E/M LEVEL III 55.00 I: 29.22- 15.78-
10.00
1 5-0802 -CRS 99213 V43.65 OFFICE
1 11/05/98 EST PT. E/M LEVEL III 55.00 I: 29.22- 15.78-
10.00
1 5-0702 -CRS 99213 V43.65 OFFICE
1 01/21/99 EST PT. E/M LEVEL III 55.00 45.00-
10.00
1 5-0502 -CRS 99213 722.10 OFFICE
1 02/04/99 EST PT. E/M LEVEL III 55.00 I: 27.71- 17.29-
10.00
1 5-0402 -CRS 99213 722.10 OFFICE
1 04/12/99 EST PT. E/M LEVEL III 55.00 I: 27.71- 17.29-
10.00
1 5-0202 -CRS 99213 V43.64 OFFICE
1 04/12/99 X-RAY FEMUR, AP & LAT. 83.00 I: 26.14- 56.86-
.00
1 5-0002 -CRS 73550 V43.64 OFFICE
1 04/12/99 X-RAY KNEE AP.LAT W/OBLIQ 77.00 I: 26.76- 50.24-
.00
1 5-0002 -CRS 73562 V43.64 OFFICE
1 04/28/99 REVISION TOTAL KNEE,1 COM 6,500.00 I: 1,470.94- 5,029.06-
.00
1 5-0005 -EJC 27486 996.4 CMC HOSP.
1 06/03/99 X-RAY KNEE AP.LAT W/OBLIQ 77.00 I: 26.76- 50.24-
.00
1 5-0002 -CRS 73562 996.4 OFFICE
061 *** *** *** *** ***
2 .00 .00 .00 75.00 75.00
It goes on and on, but my dilema is that i need to take the fist part of the
file and put it in a format that can be read by microsoft access ie
name,account,date,address,etc...
jane doe,12345,2/10/99,182 market st,etc
john doe,23455,4/8/99,109 harmony lane,etc
this much i have done...
my dilemma is getting the detail of the file into the same format. All the
data is in varying lengths, but it is consistant, i can pull the detail out
but am having trouble manipulating it...
also is there a way that i can print a file and in one font and switch to
another font in the middle of it such as in adding a barcode font... i am
using linux, if it helps...
ive approached this whole situation from varying angles and am not having
much luck...
thanks in advance..
ted fiedler
------------------------------
Date: Fri, 6 Aug 1999 11:53:19 +0100
From: "Webexchange Team" <help@xellent.co.uk>
Subject: getting files from a user through the internet
Message-Id: <7ok1s3$pls$1@nclient15-gui.server.virgin.net>
I'm trying to write a script that allows people to upload photos to my web
site. Does anyone know what modules etc I need to use? Something to point
me into the right direction would be nice.
Thanks
Lyndon Leggate
------------------------------
Date: Sun, 08 Aug 1999 10:59:35 GMT
From: jteens@my-deja.com
Subject: How to protect perl script?
Message-Id: <7ojnum$gal$1@nnrp1.deja.com>
Hello there,
Sorry if this is off topic. I've cgi script running on my site and I
don't want another host to run my cgi from their host. I try
to protect my script by check HTTP_REFERER but they send fake
HTTP_REFERER to my server so I can't block them. Any help would
be mostly apreciated.
Paul
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 8 Aug 1999 11:15:18 GMT
From: billynospam@mirror.bt.co.uk (Graham Ashton)
Subject: Re: How to protect perl script?
Message-Id: <slrn7qqpm7.je5.billynospam@wing.mirror.bt.co.uk>
In article <7ojnum$gal$1@nnrp1.deja.com>, jteens@my-deja.com wrote:
>Sorry if this is off topic.
IMO it is, it's more a web server config question.
>I've cgi script running on my site and I don't want another host to run
>my cgi from their host.
if you're using apache, this might help you;
http://www.apache.org/docs/mod/mod_access.html#deny
if not, you should get the general idea.
--
Graham
P.S. <billynospam@mirror.bt.co.uk> is a fully working address...
------------------------------
Date: Sat, 7 Aug 1999 23:32:18 +0100
From: "Ben Quick" <newsgroup@bigwig.net>
Subject: Re: I guess this is a Misc question: Cgi-bin
Message-Id: <37ad85a0.0@news2.cluster1.telinco.net>
>[snip down to my wry comment]
>> >Uh-oh, look at his name. Don't get him mad, or he might burn your
>> >barn down one night. :-)
>>
>> WHAT??????
>>
>> >David, posting from Yoknapatawpa County
>
>Sorry, I didn't think a William Faulkner reference would be that
>obscure. Especially one with a Paul Newman movie attached...
>
>BTW Ben, Paul Newman played the guy with *your* name.
Right That's why I had no idea what you were on about
>David
>--
>David Cassell, OAO
>cassell@mail.cor.epa.gov
>Senior Computing Specialist
>mathematical statistician
------------------------------
Date: Sat, 7 Aug 1999 23:34:13 +0100
From: "Ben Quick" <newsgroup@bigwig.net>
Subject: Re: I guess this is a Misc question: Cgi-bin
Message-Id: <37ad85a1.0@news2.cluster1.telinco.net>
No, in a supermarket you'd ask one of the staff and they'd point you in the
right direction. I didn't know that my post wo
uld be considered off topic until you lot gave me all this useless grief
Tom Phoenix wrote in message ...
>On Fri, 6 Aug 1999, Ben Quick wrote:
>
>> Well I'm sorry for being off topic. But to be fair, everyone (if not
>> most) here should know what the answer to my question is.
>
>By that logic, you could justify asking random strangers in a supermarket
>if you wanted to learn where to go to get treatment for syphilis. Please,
>ask only on-topic questions in newsgroups. Thank you.
>
>--
>Tom Phoenix Perl Training and Hacking Esperanto
>Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
------------------------------
Date: Sun, 8 Aug 1999 15:13:12 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: I guess this is a Misc question: Cgi-bin
Message-Id: <Pine.HPP.3.95a.990808150726.14285B-100000@hpplus03.cern.ch>
On Sat, 7 Aug 1999, Ben Quick wrote:
> No, in a supermarket you'd ask one of the staff and they'd point you in the
> right direction. I didn't know that my post wo
> uld be considered off topic until you lot gave me all this useless grief
It's only "useless" if you've refused to learn anything from it.
It still may have been useful to lurkers, though.
It's pointless making any further comments about your usenet posting
style, isn't it? You're just demanding to be plonked by many of those
who could be genuinely helpful to you. So be it.
------------------------------
Date: Sun, 08 Aug 1999 12:05:26 +0200
From: Jan Wilkening <jan@wilkening.net>
Subject: Looking for Poll Script that...
Message-Id: <37AD5666.53E4A279@wilkening.net>
Hello,
Does anyone know a script that allows for polls with multiple
answers?
Example:
What are you looking for in a computer?
Speed [X]
Color [ ]
Price [X]
must be a friend [X]
..something like that. www.pollit.com offers it, but I want my own
script :)
Anyone?
Thanks,
Jan
------------------------------
Date: 8 Aug 1999 05:19:59 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Looking for Poll Script that...
Message-Id: <slrn7qqme1.1qe.abigail@alexandra.delanet.com>
Jan Wilkening (jan@wilkening.net) wrote on MMCLXVIII September MCMXCIII
in <URL:news:37AD5666.53E4A279@wilkening.net>:
//
// Does anyone know a script that allows for polls with multiple
// answers?
//
// Example:
// What are you looking for in a computer?
//
// Speed [X]
// Color [ ]
// Price [X]
// must be a friend [X]
I'm not quite sure what you want. Is it something like:
$ perl -w
use strict;
print "What are you looking for in a computer?\n\n";
1 while <>;
exit;
__END__
^D
What are you looking for in a computer?
Speed [X]
Color [ ]
Price [X]
must be a friend [X]
^D
$
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 8 Aug 1999 13:26:44 +0100
From: "Rob Sedgwick" <newsgroups@justinfashanu.demon.co.uk>
Subject: LWP::Simple and URI::URL
Message-Id: <934115221.11619.0.nnrp-12.d4e4e97b@news.demon.co.uk>
Is there a free web host that provides these two libraries?
Rob
--
E-mail: rsedgwick@justinfashanu.demon.co.uk
Homepage: http://www.justinfashanu.demon.co.uk
Cockatiel Genetics: http://only.at/cockatiels
------------------------------
Date: Sun, 08 Aug 1999 08:32:34 -0600
From: bowman <bowman@montana.com>
Subject: Re: Newbie question about $_
Message-Id: <37AD9502.612F738C@montana.com>
Abigail wrote:
>
> animal food trough water! I fart in your general direction! Your mother
> was a hamster and your father smelt of elderberries! I do wish we could
> chat longer, but I'm having an old friend for dinner. The maple syrup
Finally got that Markov chain snippet from _The Practice of Programming_
working, did you?
------------------------------
Date: Sun, 8 Aug 1999 09:42:46 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Question about hashes.
Message-Id: <1dw51e9.21alhe1js0a68N@imac.loc>
Abigail <abigail@delanet.com> wrote:
> sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t...
> h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@...
> c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278...
> print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."...
Sorry for the irrelevant post, but I have to say that that is the
most...umm.../^(distorted|ridiculous|peculiar|horrifying)$/ use of
prototypes I have ever seen.
--
Kevin Reid: | Macintosh:
"I'm me." | Think different.
------------------------------
Date: Sun, 08 Aug 1999 08:34:43 GMT
From: donturn@my-deja.com
Subject: sed vs. grep for string manipulation?
Message-Id: <7ojff3$bil$1@nnrp1.deja.com>
i'm running into this puzzler as i'm trying to replace the strings
"card=", "cards=", or for that matter
"cardinals=".
this command works fine for grep:
grep -e card*= lookfile.txt
but this doesn't work in sed:
sed -e 's/card*=/replacestring/' lookfile.txt>newfile.txt
any help appreciated
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sun, 08 Aug 1999 10:11:31 +0200
From: Denis Pleic <dpleic@close.open.hr>
Subject: Solved: extracting terminology from text
Message-Id: <37AD3BB3.CF2759BA@close.open.hr>
David wrote:
>> I'd also like to hear any ideas regarding how to set about doing
>> this (the original text should be split into lexical units - words,
>> for comparing them with the dictionary)...
>
>You'd have to deal with such arcana as singular vs. plural
>words [see Lingua::EN::Inflect module], uppercase vs lowercase
>[see the uc and lc functions], and some parsing issues [see
>all the parsing and parser-like modules at CPAN].
>
>HTH,
>David
Well, with (more than) a little help from people on PerlWin USers list,
I've managed to come up with a solution.
As David said, to do it properly, one would require solutions to rather
complicated issues, but this was really intended as a quick-and-dirty
solution, and now it works as such. :-)
Also, there was a problem with regex \W+ as word delimiter (does not
take into account existence of various accented chars in various
languages), so that required a simple solution, too...
What I forgot to say in my original post is that the solution should be
portable, and would probably be used by computer-impaired people on
various platforms (mostly Win, probably including Mac), so I wanted to
avoid using modules, etc...
On my Web page (www.open.hr/~dpleic/tools.html) there's a small distro
of Perl, (Bigperl) consisting of only two .exe files, which the users
can download in case they've never heard of Perl before :-)))
So, the script also has to take that into account (no modules at
all!)...
Anyway, here's the script:
#!perl -w
#
# Poor Man's spell checker - just the words, doesn't like contractions
# Happiest with vanilla text. Wordlist MUST be just text.
# By Bill (Bbirthisel@aol.com)
# modified by Denis Pleic (dplec@open.hr)
#
# Usage: perl spell.pl orig-file results-file
#
# Output: number_of_occurrences unfound_word
if ($#ARGV ne "1") {
print "Wrong number of arguments!\n";
print "Syntax: perl spell.pl original-file results-file\n";
exit -1;
}
$OLD=$ARGV[0];
$NEW=$ARGV[1];
open OLD, "<$OLD" or die "can't open $OLD: $!";
open NEW, ">$NEW" or die "can't open $NEW: $!";
# location of keyword file
# you'll need to modify this if "dict.txt" isn't in current directory
open(KEYS, "dic.txt") || die "Can't open keywordfile: $!\n";
while (<KEYS>) {
tr/A-Z/a-z/; # Canonicalize to lower case.
chomp;
$KEYSPELL{$_}++
}
close KEYS;
# process input
my $word;
my @words;
my %wordcount;
while (<OLD>) {
tr/A-Z/a-z/; # Canonicalize to lower case if the keys
are.
@words = split(/\W+/, $_); # Start improvements here, this works
for English
# i.e. for text without accented characters
## for languages with accented chars, comment the above line,
## and uncomment the block below - modify the characters you need
## for your language!!!
#my @wordcharlist = qw( q w e r t z u i o p š ð a s d f g h j k l è æ ž
y x c v b n m Š Ð È Æ Ž ); # valid "word" characters, change for your
language
#
#my $regex; # the regular expression
#
#{
# local $" = '';
# my $wordchars = "[@wordcharlist]";
# $regex = "[@wordcharlist]+";
#}
# @words = split(/($regex)/, $_);
foreach $word (@words) {
# you can modify the below limit (3 chars), just use "< 2"
next if (length($word) < 3); # ignore words of less than 3 chars
if ($word =~ /^[a-z_].*/o) { # and things like 3Com
if (!defined $KEYSPELL{$word}) {
$wordcount{$word}++; # Increment the entry.
}
}
}
}
# generate results, sorted by fequency (descending)
foreach $word (sort { $wordcount{$b} <=> $wordcount{$a} } keys
%wordcount ) {
print NEW "$wordcount{$word}\t$word\n";
}
close(OLD) || die "can't close $OLD: $!";
close(NEW) || die "can't close $NEW: $!";
*****
Don't know how the above will be shown on screen, but I hope you get the
idea..
Thanks,
Denis
------------------------------
Date: Sun, 08 Aug 1999 06:09:27 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: System call in Win NT, AS Build 518
Message-Id: <37AD5757.DA8C82B6@patriot.net>
Tamim,
I'm having no trouble with it whatsoever...
#! c:\perl\bin\perl.exe
$text_file = "c:\\perl\\telnet.pl";
system("write.exe $text_file");
Tamim Hofioni wrote:
> Hello everyone,
>
> About a year ago I wrote a simple perl script on a windoze NT box using
> ActiveState's Build 502 that had the following line in it:
>
> system("write.exe $text_file");
>
> This would start up WordPad in Windoze and open the text file for the
> user to view. Recently, the perl interpreter was "upgraded" to
> Activestate's Build 518 for the better OLE stuff, but the system call
> doesn't work like it used to. Now, windoze NT starts WordPad but it
> doesn't display it on the screen -- I can see the process ID running,
> but the application isn't visible to the user. Is there a parameter to
> set here so that windoze runs it in the foreground? Perhaps qx should
> be used?
>
> Any comments? (other than don't use windows -- this is a work machine
> and they won't allow Linux!) Beuhler?
>
> -- Tamim
> -- Great quotes in history >>> Socrates: "I drank what?"
------------------------------
Date: Sun, 08 Aug 1999 20:00:18 +0800
From: wilson <wilson33@hongkong.com>
Subject: What is webpluck???
Message-Id: <37AD7151.75A6B1EC@hongkong.com>
--------------65EA005729D9BD19B195BC29
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
What is webpluck?
Where can download it?
Thank you
--------------65EA005729D9BD19B195BC29
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<font size=+1>What is webpluck?</font>
<br><font size=+1>Where can download it?</font>
<br><font size=+1>Thank you</font></html>
--------------65EA005729D9BD19B195BC29--
------------------------------
Date: Sun, 8 Aug 1999 04:33:07 -0400
From: "James A Culp III" <admin@futuristic.net>
Subject: Where to find help other than perldoc and books.
Message-Id: <7ojfp8$p94$1@ffx2nh3.news.uu.net>
Is there a newsgroup, website, or group of people one can goto for
critiques of code. I am just beginning to learn perl, and have many style
based questions that cannot or are not answered in any FAQ, or document that
I have come across.
I am interested in finding one or more experienced perl programmers
that would be willing to spend a minimal amount of time (by their
definition) to peruse code, and answer style and hard-headed newbie
questions. I would post some of these here but am frankly not anxious to A)
waste bandwidth for what most would consider silly/stupid questions and B)
draw flames upon myself for asking silly/stupid questions.
Thank you to anyone that can point me in the right direction.
Sincerely,
James A Culp III
admin@futuristic.net
http://www.futuristic.net/ for inexpensive web, domain, and e-mail hosting
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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 V9 Issue 419
*************************************