HDTenEightyP/NetNews huggingface dataset:
From: manaster@yu1.yu.edu (Chaim Manaster)
Newsgroups: comp.lang.perl
Subject: editor scripts.
Summary: Collection of perl editor scripts.
Keywords: editor editing scripts perl subroutine text
Date: 21 Jan 93 21:54:20 GMT
Organization: Yeshiva University

The following is a repost in the hope that more people will respond
this time. I have had many inquiries asking for the results of my
posting, so I know there is a good deal of interest in the matter.
This is quite logical as it is a very common need. Please respond
if you can. Here it is once again.
________________________________________________________________

Does anybody out there in netland have any perl scripts that do
simple full-screen editing on either ascii or wordprocessor format
files that they wouldn't mind sharing? They don't have to be
anything fancy, just plain vanilla editors (in fact they could be
line oriented although full-screen would be preferred).
Preferably, they would be in the form of a subroutine, but if they
are not, I imagine that it is a minor modification for me to make.
(I am obviously no pro at this stuff yet).

I will provide a summary for those interested, of the code sent, so
that an assortment of these will be available to all. I will of
course give credit to the party sending the script in the summary.

So far as I am concerned, scripts that will run on DOS ports of
perl are preferred, but UNIX versions are of interest to me, since
they could be used as a base to modify to a DOS version.

A typical use  (as a subroutine) might be: You have just written a
script that modifies interactively a set of ascii or wordperfect
files, but have come across some atypical errors that were not
planned for in your script, so you take the option in your script
(assuming you put it there) to invoke the editor, make the odd
changes in the editor and then return to your script to continue
processing the files for the rest of the errors (changes) that were
anticipated.

Thank you very much for the help.

Henry Manaster

-- 
***************************************************************************
	Henry Manaster          *     EMail: manaster@yu1.yu.edu
	Brooklyn, NY            *
                                *
	Disclaimer: The above is not necessarily MY opinion nor that 
				of anyone else :-)  ????!
****************************************************************************
 
Newsgroups: comp.lang.perl
From: hansk@aie.nl (Hans Kinwel)
Subject: Karpov Loses In 12 Moves
Organization: AI Engineering BV, Amsterdam, The Netherlands
Date: Tue, 26 Jan 1993 03:38:06 GMT

[ reposted from rec.games.chess ]

>Reuters reported from the Netherlands, Jan 18 that
>Karpov suffered one of his worst defeats ever in a
>12 move game against American Larry Christiansen in
>a GM tournament. Apparently Karpov, as Black,
>blundered on his 11the move and Christiansen played
>a double attack with his Queen.  Karpov resigned
>instead of losing his Bishop or Knight.  The game's
>moves were not reported.

Larry Christiansen???  Yeah, and his assistant Tom Wall, I bet.

I think you guys are really overdoing it...  
Now, show us that chess-playing one-liner...it's been proven to work.

Regards,
	Hans Kinwel

-- 
| "The meek shall inherit the Earth --            |       hansk@aie.nl        |
|  The rest of us will go to the stars." -- R.H.  |  (old Henry Spencer sig)  |
Newsgroups: comp.lang.perl
From: utashiro@sran230.sra.co.jp (Kazumasa Utashiro)
Subject: Re: new ftp site
Organization: Software Research Associates, Inc., Japan
Date: Mon, 25 Jan 1993 03:56:41 GMT

In article <C1Dz6n.Kst@feenix.metronet.com>
	wjm@feenix.metronet.com (Bill Middleton) writes:

These are my programs

>> assorted/TARO - work with tar files
>> assorted/sdif -  utashiro magic
>> assorted/cdif - more diff stuff

but

>> assorted/cgrep - more utashiro stuff

is not.  My grep-like program is 'mg'.  Probably you meant
this:

: From: prechelt@i41s14.ira.uka.de (Lutz Prechelt)
: Newsgroups: comp.sources.misc,comp.lang.perl
: Subject: v20i092:  cgrep2 - context grep in perl, version 2, Part01/01
: Keywords: context grep
: Message-ID: <1991Jul10.020543.17296@sparky.IMD.Sterling.COM>
: Date: 10 Jul 91 02:05:43 GMT
: Sender: kent@sparky.IMD.Sterling.COM (Kent Landfield)
: Organization: University of Karlsruhe, FRG
: Approved: kent@sparky.imd.sterling.com
: 
: Submitted-by: Lutz Prechelt <prechelt@i41s14.ira.uka.de>
: Posting-number: Volume 20, Issue 92
: Archive-name: cgrep2/part01
: Supersedes: cgrep: Volume 20, Issue 88

--utashiro
Newsgroups: comp.lang.perl
From: tbunce@cix.compulink.co.uk (Tim Bunce)
Subject: Memory leak using `...` and a workaround.
Reply-To: tbunce@cix.compulink.co.uk
Date: Thu, 28 Jan 1993 21:50:00 +0000


Using backticks in an array context such as:

        local($output) = `ls`;

leaks memory. The workaround is to force the evaluation to be
in a scalar context, e.g.,

        local($output) = scalar `ls`;

This relates to perl4 pl35 on a sun4 machine and maybe others.

Regards,
Tim Bunce.
tbunce@cix.compulink.co.uk
From: clewis@ferret.ocunix.on.ca (Chris Lewis)
Newsgroups: comp.lang.perl
Subject: Re: SOUNDEX pattern matching
Keywords: soundex, perl
Date: 24 Jan 93 09:10:37 GMT
Organization: Elegant Communications Inc., Ottawa, Canada

In article <1993Jan24.010737.5908@netcom.com> jfh@netcom.com (Jack Hamilton) writes:
>In article <1jsco2INN4dd@slab.mtholyoke.edu> jbotz@mtholyoke.edu (Jurgen Botz) writes:
>>In article <1993Jan23.184532.4933@netcom.com> jfh@netcom.com (Jack Hamilton) writes:
>>>Soundex is very useful.  It's used almost exclusively for English proper
>>>names, I believe.

>>Uh, that makes it pretty useless in the USA and elsewhere in the world
>>except England.  

I know that US English isn't the same as English English, but it's not that
far off ;-)

As one particular example of a name that I don't think is english:

butz -> B3200000
botz -> B3200000
buts -> B3200000
bots -> B3200000
boods -> B3200000
booze -> B2000000

Not bad.

>It's not designed to do all things for all people, but a lot of personal
>names in the USA and England *are* English proper names as well as english
>proper names (you left out English-speaking Canada, Australia, and New 
>Zealand, along with a host of other places where English is a primary
>language).

>The algorithm would handle some non-English names correctly (spanish/
>portuguese Jose, for example), but not all of them (french Louis, for
>example). 

Does "louis" fine - matches "lewis" as it should.  Especially the way
most Americans pronounce "louis" ;-)

You're being unduly harsh on soundex.  Soundex isn't supposed to provide
EXACT sound-alike, it produces "probably sounds reasonably similar".
Producing exact sound-alike is not something that can be done in a couple
of lines of code - good "text-to-phoneme" translators (an equivalent
task) have hundreds or thousands of rules, and will fail almost immediately
when presented with foreign words with different pronunciation rules.

In contrast, soundex is a simple mechanism that works reasonably well with
any language that uses something approaching english pronunciation.  Ie:
names transliterated by sound into roman alphabet spellings.  Especially
if you get the first letter right.  Though, it's not that hard to add
some special overrides, like leading "kn" -> "n" - it's bad when you
handle "knuth" wrong ;-)
-- 
Chris Lewis; clewis@ferret.ocunix.on.ca; Phone: Canada 613 832-0541
Psroff 3.0 info: psroff-request@ferret.ocunix.on.ca
Ferret list: ferret-request@ferret.ocunix.on.ca
Newsgroups: comp.lang.perl
From: weg@mace.cc.purdue.edu (Eythan Weg)
Subject: mesg in perl
Organization: Purdue University
Distribution: comp
Date: Thu, 28 Jan 1993 22:02:16 GMT

Since there various implementation of unix mesg, I wonder if one can
write a version in perl.  If so, please give me some pointers.

Thanks, Eythan 
Newsgroups: comp.lang.perl
From: lwall@netlabs.com (Larry Wall)
Subject: Re: How do I find the size of an associative array?
Organization: NetLabs, Inc.
Date: Thu, 21 Jan 1993 19:32:25 GMT

In article <1993Jan21.011148.10908@kpc.com> hollasch@kpc.com (Steve Hollasch) writes:
:     What's the best method to find the number of elements in an associative
: array?  The following works, but seems rather cumbersome:
: 
:         @list = keys %aa;
:         num_elements = $#list + 1;
: 
: It seems that this would be inefficient since it implies scanning through
: the whole array and copying the keys into a list.  Isn't there a quicker
: way?

In recent Perl you can say $num_elements = keys %aa.  It still has to scan
(as of 4.035), but at least you save copying the keys around.

Larry
Newsgroups: comp.lang.perl
Newsgroups: comp.lang.perl
Date: Thu, 21 Jan 1993 01:09:55 -0500 
From: Tod McQuillin <tm8t+@andrew.cmu.edu>
Subject: Re: perl support

bfischer@marblehead.East.Sun.COM (Bob Fischer - SE) writes:
> Several commercial customers I work with are interested in
> using perl, but are worried about the support issues.
> 
> I've been working with Cygnus Support to see if there is a way
> to get them to provide contract support for perl.  Are there
> any of you who would be interested in purchasing a perl support
> contract if they were available?  Please reply to me directly,
> and I'll post a summary.  Thanks.

This reminds me of something I've been meaning to bring up for a
while.  Why don't we put together a Perl service directory, listing
individuals and companies who are willing to support Perl, free or for
a fee, like the etc/SERVICE file in the Emacs distribution?  This
strikes me as a good way to add credibility for the benefit of people
like Bob mentions above, as well as a nice way for some of us to earn
a little extra income.

If anyone is interested in maintaining such a file, please speak up.
If no one offers to do it within a week or so, I'll offer to do it
myself, if the consensus is that it's a good idea.
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: Problem with m//
Originator: tchrist@pixel.convex.com
Date: Fri, 22 Jan 1993 13:50:43 GMT
Reply-To: tchrist@pixel.convex.COM (Tom Christiansen)
Organization: Convex Computer Corporation, Colorado Springs, CO
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

If you're doing a pattern match but don't want and patterns, as in 

    $p =~ s/(\W)/\\$1/g;
    $os =~ /$p/;

Then perhaps it makes more sense to simply use index() instead:

    if (index($os, $p, >= $[) { }

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist

Perle, plesaunte to prynces paye/ To clanly clos in golde so clere,
Oute of oryent, I hardyly saye/ Ne proued I neuer her precios pere.
Newsgroups: comp.lang.perl
From: pete@smtl.demon.co.uk (Pete Phillips)
Subject: Re: ftpget package - why doesn't it work ?
X-Address: Bridgend, S. Wales, CF31 1JP
Reply-To: pete@smtl.demon.co.uk
Organization: Surgical Materials Testing Laboratory
X-Fax: +44 656 667291
X-Phone: +44 656 652166
Apparently-To: mail2news@news.demon.co.uk
Date: Thu, 28 Jan 1993 13:40:25 +0000

marc@jbecpor.demon.co.uk (Marc Wilkinson) writes:

>pete@smtl.demon.co.uk (Pete Phillips) writes:
>: 
>: It doesn't seem to work, and I don't know enough about ftp and the
>: internet to find out why.
>: 	enterprise:[~pete] % ftpls -l gate.demon.co.uk  /pub
>: gives me:
>: 
>: 	Unable to connect to gate.demon.co.uk ftp port: Connection timed out 
>: 	at /usr/local/bin/ftpls line 48.
>: 

>Are you sure that the link to demon has started.  I have found often the dial
>up link takes a couple of attempts - due to busy line or whatever - before I
>connect properly.

Yep - I had a dial-up ppp link running when I did this (ran a telnet
session in another window).

Oddly enough, I tried another package (the ftp.pl package by
Alan R. Martello <al@ee.pitt.edu>) and this comes up with the error 

	Cannot open ftp to gate.demon.co.uk [21]
	Couldn't open host 'gate.demon.co.uk'

even though the ppp link was up.

All these packages use chat2.pl - is there anything I would need to
set up on our Sun for chat.pl to work (I've just installed chat2.pl as
it comes in /usr/local/lib/perl).

If I can't get this working,  I'm going to have to use expect !!  ;-)

Pete
-- 
Pete Phillips, Deputy Director, Surgical Materials Testing Lab, 
Bridgend General Hospital, S. Wales. 0656-652166 pete@smtl.demon.co.uk   
--
"Ian Snodin, who played as one of a three-man back four in the first half .."
- Ron Jones, Radio 5 (Colmenballs, EYE 811)
From: mfuhr@cwis.unomaha.edu (Michael Fuhr)
Newsgroups: comp.lang.perl
Subject: Re: mesg in perl
Date: 28 Jan 93 23:37:18 GMT
Distribution: comp
Organization: University of Nebraska at Omaha

weg@mace.cc.purdue.edu (Eythan Weg) writes:

>Since there various implementation of unix mesg, I wonder if one can
>write a version in perl.  If so, please give me some pointers.


As far as I can tell, mesg simply changes the permissions on your
terminal.  To do the equivalent of "mesg n" try:

	chop ($tty = `tty`);	# need to trim that trailing newline
	chmod 0600, $tty;	# set permissions to rw-------

"mesg y" would be:

	chop ($tty = `tty`);
	chmod 0660, $tty;	# set permissions to rw-rw----

This seems to work on my machine, but someone please let me know if I've
overlooked something.
--
Michael Fuhr
mfuhr@cwis.unomaha.edu
From: jfh@netcom.com (Jack Hamilton)
Newsgroups: comp.lang.perl
Subject: Re: SOUNDEX pattern matching
Keywords: soundex, perl
Date: 23 Jan 93 18:45:32 GMT
Organization: Netcom - Online Communication Services (408 241-9760 guest)

In article <1993Jan23.025720.1005@Happy-Man.com> Irving_Wolfe@Happy-Man.com 
writes:
>Before we get too far re-posting soundex code, let me ask another 
>question:  I tried using this thing and found it pretty useless.  
>What's it good for?  I tried to use it to find names, and it was 
>just awful at it!  Is anyone at all using this for anything real
>today, or is it a clever idea that didn't quite work?

I haven't used the Perl version, but I wrote versions in SAS and REXX which
I used extensively at my previous job (in a phone-book application).
Soundex is very useful.  It's used almost exclusively for English proper
names, I believe.

It wouldn't be useful to you if everyone who uses your program is a perfect
speller, and it would be less useful if all of the words you needed to look
up were common (and therefore likely to be spelled correctly).

Something like soundex is used by Directory Assistance and by spell check 
programs. 

-- 

-----------------------------------------------------------------------
Jack Hamilton   jfh@netcom.com   P. O. Box 281107   SF, CA   94128-1107
Newsgroups: comp.lang.perl
From: riskit@x400gate.bnr.ca (Reg Foulkes)
Subject: Perl for the Mac-Where do I find it?
Followup-To: comp.lang.perl
Organization: Bell-Northern Research
Date: Sun, 24 Jan 1993 13:40:27 GMT

Okay I'm sold on perl for unix. Know I want to try it for the mac. Where 
do I find it? Thanks.

riskit@bnr.ca
phone (613) 763-4131
Ottawa, Ontario Canada.
Newsgroups: comp.lang.perl
From: tbunce@cix.compulink.co.uk (Tim Bunce)
Subject: Burning Perl 5 Questions
Reply-To: tbunce@cix.compulink.co.uk
Date: Thu, 21 Jan 1993 19:14:00 +0000

I have some questions about Perl 5. I've been trying to
resist asking but I just can't hold back any longer!

I know you've got better things to do Larry, but a simple
Yes / Planned / Maybe / No on these would help me enormously in
planning for our future use of Perl.

Will it support new 'Standardized' functions (POSIX etc)? Such as:
        sysconf()
        pathconf()
        setsid()
        strftime()   (I *really* want this one!)
        mmap()
        TLI funcs
        Reliable Signals (sigaction etc)
        Streams funcs (putmsg, getmsg etc)
        termios funcs (tc*)

Will it support XPG3 style Internationalization?
        Locale etc.

Will it be able to do something like:

        $bytecode = compile(' ... perl code ... ');
        execute($bytecode);

        And, will I be able to store such bytecodes to disk to be
        read in and executed in other perl programs?

As it's designed to be more embedable (-lperl etc) how will that
affect the licensing terms?

Thankyou.

Regards,
Tim Bunce
tbunce@cix.compulink.co.uk

p.s. Notice I didn't ask when you'd be releasing it :-)
Newsgroups: comp.lang.perl
From: darrylo@sr.hp.com (Darryl Okahata)
Subject: Re: (undump|unexec) in HPUX [hp9000s800]
Date: Wed, 27 Jan 1993 22:25:14 GMT
Reply-To: darrylo@sr.hp.com
Organization: Hewlett-Packard / Center for Primal Scream Therapy
X-Newsreader: TIN [version 1.1 PL8.5]

mailhost (hsiegel@cvbnet.prime.com) wrote:

> I have been trying to find some way of using undump or the emacs
> unexec.c in HPUX, and have been hitting a stone wall.  The unexec.c
> comes from GNU emacs 18.59, and won't compile with the a.out headers
> native to HPUX 9000/710 (or 800), and the undump source code I have
> seems to be good only for SunOS 4.*.

     Just a correction: When compiling GNU Emacs, S700 machines use
the unexec() in unexhp9k800.c.  The one in unexec.c is *NOT* used.
The S700 unexec() also works ONLY with archive libraries; it doesn't
work with shared libraries.

     I'm afraid that I can't help you with perl's unexec(), however.

     -- Darryl Okahata
	Internet: darrylo@sr.hp.com

DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion or policy of Hewlett-Packard or of the
little green men that have been following him all day.
From: hsiegel@cvbnet.prime.com (mailhost)
Newsgroups: comp.lang.perl
Subject: (undump|unexec) in HPUX [hp9000s800]
Date: 25 Jan 93 22:01:17 GMT

I have been trying to find some way of using undump or the emacs
unexec.c in HPUX, and have been hitting a stone wall.  The unexec.c
comes from GNU emacs 18.59, and won't compile with the a.out headers
native to HPUX 9000/710 (or 800), and the undump source code I have
seems to be good only for SunOS 4.*.

Does anyone have any helpful ideas?  I suppose I could dig into the
internal structure of HPUX executables and try to do the job myself --
but I am far from confident of my expertise on HPUX.  (SunOS is another
matter, but everything works just fine there...)

Howard Siegel                   hsiegel@piano.prime.com
Computervision                  hsiegel@primerd.prime.com
Bedford, Mass.                  hsiegel%piano.prime.com@RELAY.CS.NET
(617) 275-1800 x4064            cvbnet!hsiegel@primerd.prime.com
From: clewis@ferret.ocunix.on.ca (Chris Lewis)
Newsgroups: comp.lang.perl
Subject: Re: SOUNDEX pattern matching
Keywords: soundex, perl
Date: 24 Jan 93 02:04:07 GMT
Organization: Elegant Communications Inc., Ottawa, Canada

In article <1993Jan23.025720.1005@Happy-Man.com> Irving_Wolfe@Happy-Man.com writes:
>Before we get too far re-posting soundex code, let me ask another 
>question:  I tried using this thing and found it pretty useless.  
>What's it good for?  I tried to use it to find names, and it was 
>just awful at it!  Is anyone at all using this for anything real
>today, or is it a clever idea that didn't quite work?

Oh, it works alright.

It's very useful for finding names where you're not quite sure
of the spelling.  Which makes it very good in telephone book style
applications.  Surprisingly, it works reasonably well even with
names that aren't of English origin, as long as the "correct" spelling
conforms reasonably well with English phonetics.  It's even good at
finding unpronounceable slavic names.  For example, something as
minimal as "mutsi" is sufficient for finding something like Miedzinski
(pronounced "mudZINZka") if you do the searching correctly.

If you found that it was just awful at it, I think you're not
using it right.

Users of soundex soon learn little tricks on how to find things even
easier.  Like misspelling parts of the name that they're sure of
to search for in slightly different ways, or intentionally shortening
it to make the "hit set" bigger.

It's used by very large corporations for name lookup, and works well.
I should know, I implemented it when I wrote the telephone lookup program
used internally by one of the largest corporations in this country.
It's one of its best features if I do say so myself ;-)

What is important is what additional heuristics you use.  My program,
by default, would show you exact matches if there were any.  If not,
it displays soundex matches.  It's important to recognize when the
soundex code has been padded - if it is, you may also want to
match where the first non-zero characters in the soundex code
do.  Ie: a search code of A100 matches all A1xx.

I also note that the perl implementation calculates an 8 digit soundex code.
The precision that you will use will often restrict the size of the
soundex matches.  In a corporation with something like 5,000 names,
four digit soundex works well.  With 20,000 names, you may want
to go to 5.  8 seems a trifle big for most applications.  Using long
soundex codes just tends to shorten your possible hits with long names,
and long names are where you need the widest tolerance.
-- 
Chris Lewis; clewis@ferret.ocunix.on.ca; Phone: Canada 613 832-0541
Psroff 3.0 info: psroff-request@ferret.ocunix.on.ca
Ferret list: ferret-request@ferret.ocunix.on.ca
From: tshiono@cv.sony.co.jp (Toru SHIONO)
Newsgroups: comp.lang.perl
Subject: Out of memory
Date: 28 Jan 93 11:56:13 GMT
Distribution: comp
Organization: Consumer Video Group, SONY, Osaki New city, Tokyo, JAPAN.


	I'm trying to process a very huge (1,000,000 lines) file with
a simple Perl script.
The processing is done line by line and it doesn't have to keep
previous lines; so I presume that it will work no matter how the file
may be big.

However, Perl complains "Out of memory!"

To extract the problem, I tested these scripts:

	#!/usr/bin/perl
	foreach (1 .. 1000000) {
		$line = <>;
		print $line;
	}

dies shortly, whereas

	#!/usr/bin/perl
	for ($i = 0; $i < 1000000; $i++) {
		$line = <>;
		print $line;
	}

works fine !

What makes the difference ?
I am afraid that the former loop seems to cause memory leak or
something like that.

Any suggestions ?
--
Toru Shiono (tshiono@cv.sony.co.jp)     Sony Corporation, JAPAN
From: spaf@cs.purdue.edu (Gene Spafford)
Newsgroups: comp.lang.perl
Subject: Re: Signal names vs. signal numbers
Date: 26 Jan 93 23:51:08 GMT
Organization: Department of Computer Sciences, Purdue University
NNTP-Posting-Host: uther.cs.purdue.edu
In-reply-to: chicken@npac.syr.edu's message of Tue, 26 Jan 93 11:03:00 EST

Try:

require "signal.ph";

$sigIwant = 'STOP';
$signum = eval "&SIG$sigIwant";
$signum = -$signum;
kill $signum, $$;

Of course, you should check $@ after the eval...
-- 
Gene Spafford, COAST Project Director
Software Engineering Research Center & Dept. of Computer Sciences
Purdue University, W. Lafayette IN 47907-1398
Internet:  spaf@cs.purdue.edu	phone:  (317) 494-7825
Newsgroups: comp.lang.perl
From: Dov Grobgeld <dov@menora.weizmann.ac.il>
Subject: Re: X and Perl
Reply-To: dov@menora.weizmann.ac.il
Organization: The Internet
Date: Thu, 21 Jan 1993 07:40:19 GMT

scott@winnetou.santafe.edu (Scott D. Yelich) said:

|   >	Are there any plans to include any X window system support (for
|   >even "trivial" things like form-fill-in dialog boxes) in Perl in the 
|   >near future?
|   You could run "xmessage" as an external process to do this.
|
| Have you seen WAFE?
| Scott

Yes, but it is a lot easier programming in Perl than in tcl, which is
needed for the wafe interaction. 

Larry, are your X-bindings clean enough to be released together with Perl 5.0? 
(How is the new version coming along, btw?)

--
                                                        ___   ___
                                                      /  o  \   o \
Dov Grobgeld                                         ( o  o  ) o   |
The Weizmann Institute of Science, Israel             \  o  /o  o /
"Where the tree of wisdom carries oranges"              | |   | |
                                                       _| |_ _| |_
                                       
Newsgroups: comp.lang.perl