HDTenEightyP/NetNews huggingface dataset:
From: asherman@laser.fmrco.com (Aaron Sherman)
Subject: Re: How to convice awk/sed users to use Perl ? 
Reply-To: asherman@fmrco.COM
Organization: I-Kinetics, 19 Bishop-Allen Dr., Cambridge, MA
	<1992Sep10.165908.21609@nas.nasa.gov>
Date: Fri, 11 Sep 1992 14:34:29 GMT


>>>>> pomeranz@irving.nas.nasa.gov (Hal R. Pomeranz) said:


pomeranz> I'll play Devil's advocate in the Vatican (we all know
pomeranz> Larry's got religion anyway).  There is one case where
pomeranz> necessity forces one to use ksh/sed/awk instead of Perl, and
pomeranz> that's at boot time.  "But Hal," I hear you cry, "just but a
pomeranz> (statically linked) copy of Perl in /sbin."  Unfortunately,
pomeranz> we've got 300+ standalone machines of varying architecture
pomeranz> and lack of disk space and nobody to do the maintainence of
pomeranz> Perl full time.  So, while I'd like to rewrite all my
pomeranz> /etc/rc* files in Perl, it ain't gonna happen anytime soon.

An excellent argument for having the MANUFACTURER put perl on the
distribution media. That way you make room for perl when you install,
and don't have to think about it on your own. (isn't the first time
I've thanked the devil... >;-)


			-AJS

PS: I would rewrite the rc scripts in a pseudo-language that I would
write the parser for in perl (of course, I would allow it to contain
perl code if needed)...
--
--------
Disclaimer: I am solely responsible for the content of this message.
The views expressed here may not be the views of I-Kinetics, Fidelity,
any of the Fidelity-owned corporations or my mother.
From: bwoelfel@pixmap.seas.upenn.edu (Brian Woelfel)
Newsgroups: comp.lang.perl
Subject: Is there a perl yacc?
Keywords: yacc, perl
Date: 15 Sep 92 18:26:43 GMT
Organization: University of Pennsylvania

Is there a yacc-like package for perl, i.e. something that can convert a
context-free grammar into perl code?  

Assuming it doesn't exist, would it be a bad idea for one to exist?
By this I mean would it violate some tenet of the Perl philosophy?

Is it way too hard to even conceive of?


Just wondering,

Brian Woelfel
U. Penn
From: djbpitt+@pitt.edu (David J Birnbaum)
Newsgroups: comp.lang.perl
Subject: more on socket.ph
Date: 9 Sep 92 14:24:10 GMT
Organization: University of Pittsburgh
Originator: djbpitt@unixd2.cis.pitt.edu

The error message generated by Mark's diagnostic script (reported
in an earlier posting) suggested that sys/socket.ph was being read,
but that its contents were causing the problem. Specifically, the
error message mentioned not being able to find sys/types.ph, which is
mentioned at the head of my socket.ph file.

To test this, I edited socket.ph to comment out the first five lines.
Aub now finds and uses socket.ph without problems! The following is the
head of my socket.ph file (with my '#' inserted):

	#if (!defined &KERNEL) {
	#    require 'sys/types.ph';
	#}
	#else {
	#}
	if (!defined &XTI) {
	    eval 'sub XTI {1;}';
	}
	sub SOCK_STREAM {1;}
	[...etc...]

Can anyone explain what went wrong? I have no idea what &KERNEL is
supposed to refer to, where it gets defined, and whether it should or
shouldn't be defined to work properly. I only guessed that it wasn't
needed because I had been able to cut and paste variables out of
socket.ph directly into the aub script (so that the head of socket.ph
obviously wasn't being read). If a smarter approach is to define
&KERNEL myself somewhere, how would I go about doing so?

On the aub front, it seems like socket.ph was accessible, but these
first few lines rendered the variables needed by aub unavailable. I
misread the aub error message as suggesting that the socket.ph file 
wasn't being found; in fact, the file was being found, but the
variables that it was supposed to contain weren't.

Illumination welcome,

David

-- 
Professor David J. Birnbaum         djbpitt+@pitt.edu [Internet]
The Royal York Apartments, #802     djbpitt@pittvms   [Bitnet]
3955 Bigelow Boulevard              voice: 1-412-687-4653
Pittsburgh, PA  15123  USA          fax:   1-412-624-9714
Newsgroups: comp.lang.perl
Subject: awk '{print $2}'
From: gillette@husc9.harvard.edu (Maris Gillette)
Date: 15 Sep 92 15:33:54 EDT
Distribution: world
Organization: Harvard University Science Center

Beginners Question:
	Is there a simple way to do an "awk '{print $2}'" in 
	perl?  i.e. from the command line?
Xref: sparky comp.lang.perl:5737 sci.classics:684 alt.lang.intercal:87
From: adam@owlnet.rice.edu (Adam Justin Thornton)
Newsgroups: comp.lang.perl,sci.classics,alt.lang.intercal
Subject: Re: SCRIPT: Roman numeral conversion
Date: 4 Sep 1992 21:25:54 GMT
Organization: Milo's Meadow

Of course, INTERCAL deals with Roman numbers in native mode.

So there.

Adam
-- 
"Man is conceived in sin and born in corruption and he passeth from the
 stink of the didie to the stench of the shroud.  There is _always_
 something." -- Robert Penn Warren | Vote Cthulhu in '92! | adam@rice.edu
If Rice shared my opinions I wouldn't have this disclaimer | 64,928
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: Tips and Techniques...
Originator: tchrist@pixel.convex.com
Date: Thu, 10 Sep 1992 00:54:27 GMT
Reply-To: tchrist@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.

From the keyboard of nall@sun8.scri.fsu.edu (John Nall):
:This is kind of a long shot, but.....has anyone by any chance made
:a collection of the Christiansen/Schwartz/Wall responses to questions?
:
:It occurs to me that over a period of time, the responses from those
:three would make a good compilation of tips and techniques for using
:Perl in a variety of situations.  Now, before anyone gets hurt feelings,
:let me hasten to add that I'm sure there are other frequent responders
:who are also well-versed in Perl.  But those three, between them, seem
:to respond to *every* question.
:
:So if someone has already made such a compilation, perhaps I could get
:a copy.  If not, well, guess I might grab some of the back-mail from
:the archives and give it a shot myself :-)

Look via anon ftp on convex.com in /pub/perl/newsgroup for the files
{merlyn,tchrist,lwall}.tar.Z, current as of a few minutes ago, modulo 
this article.  Just so you know what you're getting into; sizes 
(but not articles :-) are in kilobytes:

            articles    size    compressed
    lwall       1311    6552    2576
    tchrist     1126    4536    1728
    merlyn       534    1666     576


--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist
    "We all agree on the necessity of compromise.  We just can't agree on
     when it's necessary to compromise."
		--Larry Wall in  <1991Nov13.194420.28091@netlabs.com>
Newsgroups: comp.lang.perl
From: peter@merlin.acadiau.ca (Peter Steele)
Subject: Re: What's the difference between `command` and system('command')?
Organization: Acadia University
Date: Sat, 12 Sep 1992 10:53:03 GMT

>|> Where does error output go (i.e., stderr)? I have an application
>|> where I want to capture error output, not stdout.

>How about

>	@lines = `cmd 2>&1`;

>This runs cmd with stderr redirected to stdout.  It works with ksh - I
>don't know about csh.q

What's happens to normal stdout in this case? Is it lost? The application
I'm writing has to maintain normal stdout as well as stderr. Here's what
I'm doing:

  dump 0f - /somefs | compress | dd of=/dev/somedev

I want to collect the stderr output of each of these commands. The
only way I can think of doing this in perl is:

  `dump 0f - /somefs 2>1.err | compress 2>2.err | dd of=/dev/somedev >3.err`

and then open and extract the info I want from the three files that are
created. Is this a reasonable way to do this in perl?
--
Peter Steele        Unix Services Manager            peter.steele@acadiau.ca 
Acadia Univ., Wolfville, NS, Canada B0P 1X0  902-542-2201  Fax: 902-542-4364
From: matthew@sunpix.East.Sun.COM (Matthew Stier - Sun NC Development Center)
Newsgroups: comp.lang.perl
Subject: .ph and .pl files
Date: 11 Sep 1992 13:17:44 GMT
Organization: Sun Microsystems, Research Triangle Park, NC
Distribution: world
NNTP-Posting-Host: superdave.east.sun.com


This is a request for a minor change in the Configure script.

Currently is is possible to seperate the binaries and the scripts into two
seperate directories.

I'd like to see the same thing happen to the .ph and .pl files.  Ph's 
(those files created by running 'h2ph') are system dependent like binaries
are.  Pl's (packages) are typically not.

I believe I can get two directories pushed into @INC by hand altering the
'privlib' entry in config.sh to a colon seperated list of paths, before 
it does variable subsitution.  It would be nice if Configure prompted for
this 'ala scripts'.


-- 
Matthew Lee Stier                          |
Sun Microsystems ---  RTP, NC  27709-3447  |     "Wisconsin   Escapee"
Email: matthew.stier@East.Sun.COM          |
Phone: (919) 469-8300 fax: (919) 460-8355  |
From: krab@iesd.auc.dk (Kresten Krab Thorup)
Newsgroups: comp.lang.perl
Subject: Regexp question/suggestion
Date: 13 Sep 92 14:43:32 GMT
Distribution: comp
Organization: Mathematics and Computer Science, Aalborg University

How do I find the number of matches for regexp `R' in a string `S' ?
My current solution is this:

	$string = 'S';
	$mathces = ($string =~ s/R/\&/g);

Now, what is the reason for the fact, that regexp-substitusion has the
value of the number of the matches, while ordinary regexp-match
hasn't?  To me, it would seem resonable, to have an extra flag, say
`n' for regular expression matches, so that one could say:

	$matches = ($string =~ /R/n);

With $1, $2... set to the values of the LAST match.  This would be
CONSIDERABLY faster than the memory consuming substitution, wouldn't
it? 

/Kresten
Newsgroups: comp.lang.perl
From: jfh@netcom.com (Jack Hamilton)
Subject: Re: SAS compared to Perl
Date: Sun, 13 Sep 92 07:01:10 GMT
Organization: Netcom - Online Communication Services (408 241-9760 guest)

In article <hhg1-110992064042@132.197.14.85> hhg1@gte.com (Hal German) writes:
>
>This is the text version of a paper presented at the Boston Area SAS User's
>Group recently. It will also be in the proceedings of the Northeast SAS
>Users Group. Enjoy !

I now do some things using perl on the PC that I would previously have
done in SAS.  Both are useful.  Perl is faster and has better string
manipulation capabilities; on the other hand, SAS has a lot of statistical,
graphical, and data entry tools that perl doesn't.  Different tools for
different jobs. 

SAS's major usage base is still on IBM mainframes, I believe.  Has anyone
ported perl to VM/CMS or MVS?  I'd think that CMS would be a more
sympathetic environment.


-- 

-----------------------------------------------------------------------
Jack Hamilton   jfh@netcom.com   P. O. Box 281107   SF, CA   94128-1107
Newsgroups: comp.lang.perl
Subject: Has anyone got perl 4.35 running on RISC Ultrix 4.1
From: austin@mdcbbs.com (Austin Benson)
Date: 10 Sep 92 02:04:41 PDT
Organization: Shape Data - a division of EDS Ltd

This has probably been asked and answered before, but I wasn't interested
at the time and we only keep 4 days worth of articles here :-(.

I am trying to get perl 4.35 running on our Ultrix system (uname -a says
"ULTRIX dmipsfs 4.1 0 RISC"). I can't get it through the C compiler stage -
after fixing a couple of problems caused by fascist typing (can't use a
pointer to a struct before the struct is fully defined, and (thing *) is not
assignment compatible with (thing volatile *) !) it is currently dying with

    ugen: internal   : line 2 : eval.p, line1022
                     illegal size in load/store

which is totally incomprehensible to me.

If anyone can give me (pointers to) a solution I will be very grateful.
From: djbpitt+@pitt.edu (David J Birnbaum)
Newsgroups: comp.lang.perl
Subject: aub problem finding sys/socket.ph
Date: 8 Sep 92 15:44:51 GMT
Organization: University of Pittsburgh

I have been unable to persuade aub to find my sys/socket.ph file. The
author of aub has been very helpful in trying to track down the problem,
but without success. The problem is apparently not with aub, but with 
something I've done; I am the only user to report this. I know nothing
about perl and have no idea where I've gone wrong; does anyone recognize
this error? (There is a work-around, described below; while it lets me
use aub, it still leaves me frustrated and puzzled.)

I built perl myself and installed it in my personal bin, using 'make
install' to install the library files into my personal lib. This means
that my copy of perl knows where its lib files are (since it deposited
them there itself). I verified this by running:

   #!/afs/pitt.edu/usr/djbpitt/bin/perl
   foreach (@INC) {
      print "$_\n";
   }

and it reported the full, correct path: /afs/pitt.edu/usr/djbpitt/lib/perl.
I then used h2ph to create /afs/pitt.edu/usr/djbpitt/lib/perl/sys/socket.ph.

When I run aub with the -d2 (debugging) option, it tells me that it is
looking in the right place for sys/socket.ph, but doesn't find it. I
then tried specifying the full path to my perl lib directory using the -I
command line option, but this, too, failed. 

I work around the problem by commenting out the aub line that looks for
socket.ph and pasting the necessary values by hand from my socket.ph
file directly into the aub script. Everything then works as advertised.
I can live with this, of course, but it isn't the way nature intended
perl scripts to operate. Can anyone suggest where I might have gone wrong? 

Thanks,

David

-- 
Professor David J. Birnbaum         djbpitt+@pitt.edu [Internet]
The Royal York Apartments, #802     djbpitt@pittvms   [Bitnet]
3955 Bigelow Boulevard              voice: 1-412-687-4653
Pittsburgh, PA  15123  USA          fax:   1-412-624-9714
From: sylvia@Tandem.com (Sylvia Tom)
Newsgroups: comp.lang.perl
Subject: usersub problems when invoked within a subroutine
Date: 11 Sep 92 20:10:54 GMT
Organization: Tandem Computers

Keywords: usersub

Thanks for posting the notes on how to hook in usubs.
I've compiled ex1.c on a sun workstation and found
the following problem.  If I call opie from within 
a subroutine and the subroutine returns a list,
the resulting information returned is lost.  If,
I put parenthesis around $new in the call to opie,
eg ($new) = &opie($num), the script runs as
expected.  Do you know why this is behaving this way?

Thanks,
sylvia
sylvia@tandem.com


sub getval
{
   local ($num) = @_;
   print "number entered is $num \n";
   $new =&opie($num);
   print "new = $new \n";
   local ($buf) = "hi there ";
   local($res) = 1;
   return ($new,$buf,$res);
} #===============================================
if ( defined(&opie) ) {
    print "&opie is defined\n";
    print "\t&opie(10) = ", &opie(10), "\n";
} else {
    print "&opie is not defined\n";
}


($val,$buffer,$result) = &getval (5);
print "val = $val \n";
print "buffer = $buffer \n";
print "result = $result \n";
#===================================================

#resulting output ->

&opie is defined
	&opie(10) = 101.20000000000000284
number entered is 5 
new = 26.199999999999999289 
val = 1 
buffer =  
result =  
 
Newsgroups: comp.lang.perl
From: ronys@calisto.robcad.uunet (Rony Shapiro)
Subject: class negation broken - OR - what am I doing wrong ?
Followup-To: comp.lang.perl
Organization: Robcad Technologies ( 1980 ) Ltd, Israel
Date: Wed, 9 Sep 1992 13:49:20 GMT

Hello,

Given a file which contains all 26 letters, one character per line, i.e.
a
b
c
.
.
.
z

I'd expect the following perl one-liner to print all characters except 'f':

	perl -n -e 'print if /[^f]/' file

However, ALL of the characters are printed.

As a check,
	 perl -n -e 'print unless /[f]/' file
works as expected on the same data.


Is the problem with perl or my understanding of [^f] ?

Platform: Sparc IPC running SunOS 4.1.2
Perl compiled with cc.

perl -v

This is perl, version 4.0

$RCSfile: perl.c,v $$Revision: 4.0.1.7 $$Date: 92/06/08 14:50:39 $
Patch level: 35

-- 
		Rony Shapiro

	ronys%robcad@uunet.uu.net OR  uunet!robcad!ronys
From: jfh@netcom.com (Jack Hamilton)
Newsgroups: comp.lang.perl
Subject: Re: SAS compared to Perl
Date: 14 Sep 92 01:29:39 GMT
Organization: Netcom - Online Communication Services (408 241-9760 guest)

In article <1992Sep13.211257.26114@ccu1.aukuni.ac.nz> 
russell@ccu1.aukuni.ac.nz (Russell Fulton) writes:
>
>For our network billing I use perl to analyse the raw email logs, reading
>addressess and deciding if the address is local or not (using a
>complicated list of regular expressions something that SAS can't do).

Regular expressions are certainly one of the crowning glories of perl.  It
would be nice if they could be added to SAS as well, if SAS's syntax
permits the ffull power of RE's to be used.  In fact, the person at SAS who
might do it reads this list (hint, hint).

-- 

-----------------------------------------------------------------------
Jack Hamilton   jfh@netcom.com   P. O. Box 281107   SF, CA   94128-1107
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: What's the Right Way to undump perl on a SPARC?
Date: 9 Sep 92 06:17:42 GMT
Organization: NetLabs, Inc.

In article <lapqb4INN83m@news.bbn.com> cjross@bbn.com (Chris Ross) writes:
: 
: When I use undump (from the Tex 3.0 distribution), the resulting
: binary crashes when run.  When I try to build perl with unexec.c
: from the Gnu Emacs distribution, ld complains that `start_of_data'
: and `start_of_text' are undefined.
: 
: I could dig deeper on my own, but I'm out of time.
: Can perl be undumped on a SPARC, or am I out of luck?

Yes, but you have to use a Perl that's linked with -Bstatic.

Larry
From: djbpitt+@pitt.edu (David J Birnbaum)
Newsgroups: comp.lang.perl
Subject: socket.ph - solved
Date: 9 Sep 92 22:03:20 GMT
Organization: University of Pittsburgh

To bring the socket.ph story to a happy conclusion, I converted
_all_ *.h files to *.ph files, whereupon aub ran happily. This required
no tinkering with the contents of aub or with the various *.ph files.

Thanks to everyone who offered suggestions - especially Mark, Tom, and
Randal.

--David

-- 
Professor David J. Birnbaum         djbpitt+@pitt.edu [Internet]
The Royal York Apartments, #802     djbpitt@pittvms   [Bitnet]
3955 Bigelow Boulevard              voice: 1-412-687-4653
Pittsburgh, PA  15123  USA          fax:   1-412-624-9714
Newsgroups: comp.lang.perl
From: Dov Grobgeld <dov@menora.weizmann.ac.il>
Subject: Regexp bug/feature?
Reply-To: dov@menora.weizmann.ac.il
Organization: The Internet
Date: Mon, 7 Sep 1992 09:21:54 GMT

I have as input, strings of a type called HOLLERITH which are given
by the length as an integer in ASCII characters, followed by "H" followed
by the string. Examples of such strings are "3Haaa", "16Hthis\nis\na string".

I tried matching them with the following regular expression:

    if (s/(\d+)H([\000-\377]{\1})//) {
        print "string= ($2)\n";
    }

but it didn't work. The following did work though:

    if (s/(\d+)H//) {
        s/([\000-\377]{$1})//;
        print "string= ($1)\n";
    }

It seems like you can't give \1,\2,...,\9 inside braces in the same
regular expression. I guess I can live without it. It just means that
I can't use the m//g construct in order to match such strings...
Larry, can this be fixed?

By the way, it is quite ugly to have to write [\000-\377] in order to
say "any character". What about providing a hook for redefining "." to
include "\n"?

This reminds me of the "\b" construct, which is quite crippled when working
with character sets other than English, since it is impossible in Perl to
redefine what is a letter and what is a white-space. E.g. in Swedish
"ASCII" standard the characters "}", "{", "|" and some others are
used as letters.

Certainly the problems won't go away when Perl is ported for Unicode...
What about providing such hooks already now?

--
                                                        ___   ___
                                                      /  o  \   o \
Dov Grobgeld                                         ( o  o  ) o   |
The Weizmann Institute of Science, Israel             \  o  /o  o /
"Where the tree of wisdom carries oranges"              | |   | |
                                                       _| |_ _| |_
From: noran!iowa!kburton@uunet.uu.net (Kevin Burton)
Newsgroups: comp.lang.perl
Subject: RE: Case dependent substitution
Date: 10 Sep 92 19:48:24 GMT
Reply-To: noran!iowa!kburton@uunet.uu.net
Organization: The Internet


Tom Christiansen writes:

|  I've often wanted a /I switch that behaved this way.  Here's
|  what I use:
|  
|      s/abc/&mapcase('xyz')/gie;
|  
|  where mapcase is as follows:
|  
|      sub mapcase {
|  	local($lhs, $rhs) = ($&, shift);
|  	for (local($i) = 0; $i < length($lhs); $i++) {
|  	    substr($lhs, $i, 1) =~ tr/A-Z//
|  		? substr($rhs, $i, 1) =~ tr/a-z/A-Z/
|  		: substr($rhs, $i, 1) =~ tr/A-Z/a-z/;
|  	}
|  	$rhs;
|      }
|	.
|	.
|	.
|  But it's not entirely satisfactory.  Consider
|  
|      $_ = "Green is the green apple who has GREEN WORMS\n";
|      print;
|      s/green/&mapcase3('red')/gie;
|      print;
|  
|      print "\n";
|  
|      $_ = "Red is the red apple who has RED WORMS\n";
|      print;
|      s/red/&mapcase3('green')/gie;
|      print;
|  
|  
|  Yields:
|  
|      Green is the green apple who has GREEN WORMS
|      Red is the red apple who has RED WORMS
|  
|      Red is the red apple who has RED WORMS
|      Green is the green apple who has GREen WORMS

Thanks for the reply it gave me enough to generate the solution that
is as follows:

	sub mapcase {
		local($lhs, $rhs) = ($&, shift);
		local($i,$j);
	
		# the case of the target will match th case of the source
		for ($i = 0; $i < length($lhs); $i++)
		{
		    substr($lhs, $i, 1) =~ tr/A-Z//
			? substr($rhs, $i, 1) =~ tr/a-z/A-Z/
			: substr($rhs, $i, 1) =~ tr/A-Z/a-z/;
		}
	
		# Avoid getting GReen when substituting re5 with green
		while(substr($lhs, $i-1, 1) !~ tr/A-Za-z//)
		{
			$i--;
		}
		# Avoid getting GREen when substituting red with green
		for ($j = $i; $j < length($rhs); $j++)
		{
		     substr($lhs, $i-1, 1) =~ tr/A-Z//
			? substr($rhs, $j, 1) =~ tr/a-z/A-Z/
			: substr($rhs, $j, 1) =~ tr/A-Z/a-z/;
		}
	
		$rhs;
	}

Thank you!

-

This is not an official statement of Noran Instruments. No warranty is
expressed or implied. The information included herein is not to be construed
as a committment on Noran's part.

Kevin Burton
Noran Instruments				voice: (608) 831-6511 x317
2551 West Beltline Highway, Room 532		  FAX: (608) 836-7224
Middleton, WI 53562				email: kburton@noran.com
Newsgroups: comp.lang.perl
From: andy@orchid.bdc.ubc.ca (Andrew Dwelly)
Subject: STDOUT & STDERR
Organization: University of British Columbia, Vancouver, B.C., Canada
Date: Mon, 14 Sep 1992 22:48:32 GMT


Another beginners question. Whats the idiom in perl for starting
a sub process with a filehandle, and getting both the STDOUT and
the STDERR of that process for subsequent parsing ??

I suppose what I have in mind is something like :-

open (CHILD, "child_process 2>&1 |"); # I don't think this works!
while (<CHILD>)
{
   do_something_with_child_here;
}

that is, to be able to read the child's STDOUT, and STDERR in order
to see when something horrid has happened to child_process.

Andy (andy@bcu.ubc.ca)