HDTenEightyP/NetNews huggingface dataset:
From: hanusj@storm.CS.ORST.EDU (Joe Hanus)
Newsgroups: comp.lang.perl
Subject: Help with variable interpolation inside s/// (repost)
Keywords: variable interpolation, substitution
Date: 11 Sep 92 22:24:22 GMT
Article-I.D.: CS.1992Sep11.222422.24918
Followup-To: comp.lang.perl
Organization: Computer Science Dept., Oregon State University
Originator: hanusj@storm.CS.ORST.EDU




We have written a short capitalization script that's not working. The
script assumes all words not found in a standard dictionary are proper
nouns.  Those found in the dictionary are capitalized by replacing
with the word from the dictionary. 

The line giving the problem is commented
We are using perl 4.035

Can you pinpoint my problem or suggest a work-around?
Any help would be appreciated.
-------------------------------------------------------

#!/usr/bin/perl

# get exceptions...
open( CHANGES, "/usr/dict/words" );
@words = <CHANGES>;
close( CHANGES );


# now do the capitalization for each line of the input file...
while ( <> ) {

   # begin by assuming every word is a proper noun.
   # capitalize every word...
   tr/A-Z/a-z/;
   while ( ($firstletter) = /\b([a-z])/ ) {
      $firstletter =~ tr/a-z/A-Z/;
      s/\b([a-z])/$firstletter/;
   }

   # take care of the exceptions...
   # for each word read in from the list
   foreach $word ( @words ) {

      s/$word/$word/gi;   # this is the line that's not working.

      # find the word in $word regardless of case and 
      # substitute the word in $word as it was capitalized in the 
      # dictionary


#---------------------------------------




   # print the line...
   print;
}

--

------------------------------------------------------------------------------
Joe Hanus                            | E-MAIL hanusj@bionette.cgrb.orst.edu
Microbial Germplasm Database         |
Dept. of Botany and Plant Pathology  | Phone  (503)-737-5300
Oregon State University              | FAX    (503)-737-3045
Corvallis, OR 97331-2902             |
______________________________________________________________________________
Newsgroups: comp.lang.perl
From: utashiro@sran230.sra.co.jp (Kazumasa Utashiro)
Subject: Re: processing of "diff -c" for code reviews
Organization: Software Research Associates, Inc., Japan
Date: Mon, 7 Sep 1992 08:07:38 GMT

In article <17580@autodesk.COM> dansmith@Autodesk.COM (Daniel Smith) writes:
>> 
>> 	Looking for something that can take a context diff (like diff -c)
>> and process it so that it can be useful in code reviews.  Any pointers
>> to scripts already written out there?

I hope that you'll like my cdif and sdif.  Cdif is
post-processor of diff which hilights modified part of text
by changing text attributes.  Sdif is a clone of System V
sdiff command but more powerfull except lack of -o option.
Sdif can handle cdif output.

I posted these to comp.lang.perl and alt.sources in May of
this year.  These are also available by anonymous ftp from:

	sra.co.jp[133.137.4.3]:~ftp/pub/lang/perl/sra-scripts

These are slightly updated from ones posted in May.

--utashiro
From: djbpitt+@pitt.edu (David J Birnbaum)
Newsgroups: comp.lang.perl
Subject: Re: aub problem finding sys/socket.ph
Date: 9 Sep 92 20:22:16 GMT
Organization: University of Pittsburgh

In article <1992Sep9.142703.12533@news.eng.convex.com>
tchrist@convex.COM (Tom Christiansen) writes:

>Building all the *.ph files is something of a black art.  For 
>any given *.h file, you first have to build every include 
>file it itself includes, recursively.

This seems to be the step I was overlooking! socket.ph was happily where
it belonged, but it was the only sys/*.ph file I generated (I didn't
know that I needed the others) and was apparently unusable alone. One
private email message explained:

>you really, really, really do need to do the following:
>
>	cd /usr/include; h2ph * */*
>
>if you don't have *all* the .ph files, all bets are off.

Since I believe in doing anything I really, really, really need to do,
I'll restore socket.ph to its original state, run h2ph on all the other
*.h files, and try again (this time, optimistically). 

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
Newsgroups: comp.lang.perl
From: sue@ruby.UUCP (Sue Willing)
Subject: Re: Camel Book for 5.xxx hardback?
Organization: O'Reilly & Associates, Inc.
Date: Fri, 11 Sep 1992 15:24:54 GMT

From article <BUUS.92Sep9152420@spica.bu.edu>, by buus@spica.bu.edu (Bryan Buus):
> 
>> Yeah - mine started losing pages after 2 weeks.  I called them, and
>> the new book will have a different binding.  Yea!
> 
> Yup, the latest printing has a paperback 'lay-flat' binding.. it's
> really great.  I just wish that the new addition of MH-xmh had it too! :)

This different lay-flat binding is called RepKover.  It uses a more
durable and flexible glue process than perfect binding and should address
all the needs our customers have shared with us over the past few years.

We're implementing it on the bulk of our Nutshell books.  
Programming perl is now available that way.  
Unfortunately there is a "bulk-size" limit for this binding (1 1/8"
maximum and 1/4" minimum).  Mh and xmh exceeds the maximum, so we've 
had to remain with perfect binding for that.

I've gotten no feedback yet on the new binding...which I take as good
news...but our printer and I would be very interested to know how
it stands up in the real world.

Sue Willing
Print Coordinator
O'Reilly & Associates, Inc.
sue@ora.com


-- 
Sue Willing: (617) 354-5800
Printing Coordinator
O'Reilly & Associates, Inc.
90 Sherman Street, Cambridge, MA 02140
From: stantz@sgi.com (Mark Stantz)
Newsgroups: comp.lang.perl
Subject: Re: aub problem finding sys/socket.ph
Date: 9 Sep 92 04:35:04 GMT
Organization: Silicon Graphics, Inc.

In article <5601@blue.cis.pitt.edu.UUCP> djbpitt+@pitt.edu (David J Birnbaum) writes:
>I have been unable to persuade aub to find my sys/socket.ph file...

	Let's omit aub from the problem to simplify things...

	Suppose we have a program:

		#!/usr/local/bin/perl

		foreach (@INC) {
		  print "library $_\n";
		}

		require <sys/socket.ph>;
		print &AF_INET . "\n";

	On my system, this prints:

		library /usr/local/lib/perl
		library .
		2

	For the user, the output would be:

		library <X>
		library <Y>
		Undefined subroutine "main'AF_INET" called at /tmp/aaa line 8.

	The user has generated sys/socket.ph and placed it in the directory
<X> or <Y>.  Running with '#!/usr/local/bin/perl -I <X>' doesn't help.  I
think it's a problem with the way perl was built at the site, not a problem
with perl itself.  Can't figure out what, through.

	-Mark
Newsgroups: comp.lang.perl
From: asherman@laser.fmrco.com (Aaron Sherman)
Subject: Re: processing of "diff -c" for code reviews
Reply-To: asherman@fmrco.COM
Organization: I-Kinetics, 19 Bishop-Allen Dr., Cambridge, MA
Date: Wed, 9 Sep 1992 21:14:06 GMT


>>>>> utashiro@sran230.sra.co.jp (Kazumasa Utashiro) said:

utashiro> dansmith@Autodesk.COM (Daniel Smith) writes:

>> 	Looking for something that can take a context diff (like diff -c)
>> and process it so that it can be useful in code reviews.  Any pointers
>> to scripts already written out there?

utashiro> I hope that you'll like my cdif and sdif.  Cdif is
utashiro> post-processor of diff which hilights modified part of text
utashiro> by changing text attributes.  Sdif is a clone of System V
utashiro> sdiff command but more powerfull except lack of -o option.
utashiro> Sdif can handle cdif output.

If the original poster wanted something to look at at a conference
table with others around, this may not work, since getting a terminal
to the meeting might not be trivial.

I've actually found that GNU's diff -u (unified diff) is quite
readable. Here is a sample:

--- c.c.old	Wed Sep  9 16:11:36 1992
+++ c.c		Wed Sep  9 16:12:26 1992
@@ -1,8 +1,9 @@
 #include <stdio.h>
 
-main(argc,argv)
-	int argc;
-	char *argv[];
+void
+main(int argc,char *argv[])
 {
 	printf("Hello, world!\n");
+
+	exit(0);
 }


--
--------
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.
Newsgroups: comp.lang.perl
From: kebsch@neurotic.sni.de (Waldemar Kebsch)
Subject: dbm problems/questions (msdos-perl).
Organization: Siemens Nixdorf Info.Sys. AG, Paderborn, Germany
Date: Tue, 15 Sep 1992 11:46:16 GMT

Hi,

I have fetched PERL419X.ZIP from Simtel and it runs fine. Because I have
no experience with dbm I wrote a simple example using dbmopen(), dbmclose(),
etc.. It works fine, but the [????????.dir] file is only 0 bytes long???

Here some piece of information ..
---------------------------------------------------------------------------
The PERL script, I wrote ...
---------------------------------------------------------------------------
    # Simple dbm test (W. Kebsch)

    dbmopen(db, 'database', 0666);

    $db{'a'} = 'Data(a)';
    $db{'b'} = 'Data(b)';
    $db{'c'} = 'Data(c)';

    dbmclose(db);

    dbmopen(db, 'database', 0666);

    @keys = keys(%db);
    @values = values(%db);
    printf("keys=%d, values=%d\n", $#keys + 1, $#values + 1);

    while(($key, $value) = each(db)) {
	printf("key=%s, value=%s\n", $key, $value);
    }

    dbmclose(db);
---------------------------------------------------------------------------
The directory before running the script ...
---------------------------------------------------------------------------
PERL286  EXE   324619  23.02.92  11.20
TDBM     PL       399  15.09.92  13.29
---------------------------------------------------------------------------
The output of the command: "C>PERL286 TDBM.PL"
---------------------------------------------------------------------------
keys=3, values=3
key=b, value=Data(b)
key=a, value=Data(a)
key=c, value=Data(c)
---------------------------------------------------------------------------
The directory after running the script ...
---------------------------------------------------------------------------
PERL286  EXE   324619  23.02.92  11.20
TDBM     PL       403  15.09.92  13.29
DATABASE PAG     1560  15.09.92  13.32
DATABASE DIR        0  15.09.92  13.32
---------------------------------------------------------------------------

Hmm .., what's going wrong (what I am doing wrong?) ?

Thanks in advance for your help!
Waldemar
--
Waldemar Kebsch, c/o  SIEMENS NIXDORF Informationssysteme AG, STO SI 32,
			   W-4790 Paderborn, Federal Republik of Germany
Email (USA)  : kebsch.pad@sni-usa.com        |  Phone: (+49) 5251 835645
Email (World): kebsch.pad@sni.de             |  Fax  : (+49) 5251 835602
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: stdout from 'system'?
Originator: tchrist@pixel.convex.com
Date: Thu, 10 Sep 1992 18:32:48 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 lynch@hpcc01.corp.hp.com (Howard Lynch):
:Specific:  I want to get the hostname of the system my perl script is running
:           on into a script variable.
:
:           The ksh equivalent would be:
:
:                HOST=`hostname`
:                echo $HOST
:
:           The best way I can figure out to do this with perl is:
:
:           	open(ASDF,"hostname|");
:           	chop($hostname=<ASDF>);
:           	close(ASDF);
:           	print "hostname = $hostname";
:
:General:  I want to get the stdout from a unix command into a script variable.
:          It would seem like I should be able to use the 'system' command
:          and capture its stdout into a script variable.

You've forgotten that backticks work in perl:

    print "hostname = ", `hostname`;

Note that the newline will be left intact.

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist
    It won't be covered in the book.  The source code has to be useful for
    something, after all...  :-)
            --Larry Wall in <10160@jpl-devvax.JPL.NASA.GOV>
Newsgroups: comp.lang.perl
From: robt@is.morgan.com (Rob Torop)
Subject: Re: ? Perl5 ?
Organization: Morgan Stanley & Company
Date: Tue, 15 Sep 1992 02:38:49 GMT

In article <lba8arINNg43@jethro.Corp.Sun.COM> Eric.Arnold@Sun.COM (Eric arnold) writes:

   Is there a general list of what will be in Perl 5, and when?  I'm
   considering Perl for wider use, and more intense applications, but I
   crave REAL structures/nested data types.  (It would also be neat to
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

   Me too!
--
-- Rob Torop

+---------------------------------------------------------------------+
| The views expressed here are neither mine nor those of my employer. |
+---------------------------------------------------------------------+
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: aub problem finding sys/socket.ph
Originator: tchrist@pixel.convex.com
Date: Tue, 8 Sep 1992 17:44:34 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 djbpitt+@pitt.edu (David J Birnbaum):
: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.)

Did you run h2ph (and maybe c2ph if it needs it) on /usr/include/sys/socket.h
and place the results in (for example) /usr/local/lib/sys/socket.ph?

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


		Disco is to music what Etch-A-Sketch is to art.
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: Use of 'b' templates
Date: 11 Sep 92 18:35:09 GMT
Organization: NetLabs, Inc.

In article <memo.619212@cix.compulink.co.uk> pmoore@cix.compulink.co.uk writes:
: The subject says it, really. Can somebody tell me how 'b' and 'B' templates
: work, in pack() and unpack()? Preferably with a few examples to make things
: clear.
:  
: I have just struggled to an understanding of vec(), but 'b' is beyond me...
:  
: [NB: if it matters for examples, my machine stores bytes such that
:  
:    for $i (0..15)
:    {
:       print vec('31',$i,1) ? '1' : '0';
:    }
:  
: gives 1100110010001100]

Saying unpack('b*', '31') gives you the same as vec().  Saying
unpack('B*', '31) gives you the same thing, only with the bits reversed
in each byte.  In other words, b starts with the 1 bit, and B starts
with the 128 bit.  Since binary numbers are usually written big-endian,
use B to display binary numbers.  Since vec() starts storing bits at
the low end, use b to display vec() values.

Use pack to translate the other direction.

The h and H templates specifiers work just the same, only nybble by nybble
rather than bit by bit.

Larry
From: tchrist@convex.COM (Tom Christiansen)
Newsgroups: comp.lang.perl
Subject: Re: Question on Camel Book
Date: 12 Sep 92 18:35:07 GMT
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: Convex Computer Corporation, Colorado Springs, CO
Originator: tchrist@pixel.convex.com
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 kc@hpscit.sc.hp.com (Kwok Cheung):
:	I am fairly new on perl and have use awk and sed for
:a long time. I have a question in regard to the camel book.
:On p.259 the nfinger program, can any one explain what is the
:meaning of the following line.
:
:exec 'finger', @fingerargs, @finger if @finger;
:
:The last part is the one I have problem in trying to understand
:
: @finger if @finger

Consider that the exec line is really

    exec('finger', @fingerargs, @finger)	 if @finger;

Meaning run this command if we found anyone to finger.

:when I run it with the full line, it just return with
:
:Couldn't run finger:
:
:Even I specific the full path to finger '/usr/bin/finger"
:But when I delete the last 3 word
:
:exec 'finger', @fingerargs;
:
:The nfinger runs, but I cannot pass on the logon to the program.

I would look at what the list @finger contains: I suspect it's empty.

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

    #else /* !STDSTDIO */     /* The big, slow, and stupid way */
        --Larry Wall in str.c from the perl source code
Newsgroups: comp.lang.perl
From: chare@unilabs.uucp (Chris Hare)
Subject: stupid questions : deleted ing leading spaces
Organization: None: Just Me, Chris Hare
Date: Mon, 7 Sep 1992 02:23:51 GMT

This is stupid.

I am running 4.035 and I need to delete a single leading space at the
beginning of a line.

I would have thought that 

         tr/^ //;

would have worked since the line is in $_.

But alas, it doesn't.  There are other spaces in the line, but I don't want
them affected.

As a matter of ofact, if you can suggest a way to remove the leading
spaces, and compact multiple spaces any where else on the line to be one
space I'd appreciate it.

Thanks!
-- 
????                --- It Always works for me! ---                           
Chris Hare, UNIX Scientist                  Preferred : chare@unilabs.uucp
Just a mild-mannered consultant by day ....
From: rick@sjsumcs.sjsu.edu (Richard M. Warner)
Newsgroups: comp.lang.perl
Subject: Re: SAS compared to Perl
Date: 14 Sep 92 22:07:05 GMT
Organization: San Jose State University, Math & CS

In article <1992Sep13.211257.26114@ccu1.aukuni.ac.nz> russell@ccu1.aukuni.ac.nz (Russell Fulton) writes:
>From: russell@ccu1.aukuni.ac.nz (Russell Fulton)
>Subject: Re: SAS compared to Perl
>Date: 13 Sep 92 21:12:57 GMT
>jfh@netcom.com (Jack Hamilton) writes:
>
>>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
>
> Not any more I think, SAS runs on all sorts of systems from PCs to
>mainframes. 

True, but it is still *primarily* a mainframe/mini package.  But, I do not
think that the IBM mainframe world is its major field anymore - I think
that is about split between IBM and DEC.  Yes, it runs on PC's, but
there is a problem here.  The DOS version is a bit wimpy, too overlayed,
and an orphan (no upgrades past 6.04 while everything else is moving to
6.08).  The Windows version has problems.  SAS seems to likethe OS/2 
platform, in preference to Windows, but the OS wars may change their minds.
If you doubt that the big machines are still their primary domain, look
back a year and a half ago when SAS Institute put the Windows version on
hold so they could concentrate on bug fixes for the MVS, VM/CMS, and 
VMS platforms.

>
>-- 
>Russell Fulton, Computer Center, University of Auckland, New Zealand.
><rj_fulton@aukuni.ac.nz>
Newsgroups: comp.lang.perl
From: mcook@melkur.dev.cdx.mot.com (Michael Cook)
Subject: Re: Case dependent substitution
Organization: Motorola Codex, Canton, Massachusetts
Date: Thu, 10 Sep 1992 17:44:18 GMT

Kevin Burton <noran!iowa!kburton@uunet.uu.net> writes:

>I would like to substitute an arbitrary pattern for another, but it all of
>the alphabetic characters in the source pattern are upper case I would like
>to case the replacement pattern to also force upper case substitution.

>For example:

>	substitute "abc" in "ABCxyzabc" with "xyz" produces "XYZxyzxyz"
>	substitute "abc" in "abcxyzABC" with "xyz" produces "xyzxyzXYZ"

I was thinking that you could do something like this:

	s%abc% ($k = $&) =~ /a-z/ ? "\L$k" : "\U$k" %gie;

But it doesn't work.  It seems inside match (/a-z/) always fails, and you
always get "\U$k".  Hmm...

Michael.
Newsgroups: comp.lang.perl
From: pomeranz@irving.nas.nasa.gov (Hal R. Pomeranz)
Subject: Re: How to convice awk/sed users to use Perl ? 
Organization: NAS, NASA Ames Research Center, Moffett Field, CA
Date: Thu, 10 Sep 92 16:59:08 GMT


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

--
===============================================================================
Hal Pomeranz     Senior Member of Technical Staff     NASA Ames Research Center
	     pomeranz@nas.nasa.gov     pomeranz@cs.swarthmore.edu
       "Tell me are we living or are we wasting time?"  --Law and Order
Newsgroups: comp.lang.perl
From: jhd@irfu.se (Jan D.)
Subject: Re: What's the Right Way to undump perl on a SPARC?
Date: Thu, 10 Sep 1992 23:16:33 GMT
Organization: Swedish Institute of Space Physics, Uppsala, Sweden

In article <ASHERMAN.92Sep9170013@laser.fmrco.com> asherman@fmrco.COM writes:
>>>>>> cjross@testament.bbn.com (Chris Ross) said:
>
>cjross> I could dig deeper on my own, but I'm out of time.
>cjross> Can perl be undumped on a SPARC, or am I out of luck?
>
>I think that it would be marvelously useful for Larry to put undump
>into the standard distribution. I wanted to undump something last
>night, and then someone told me just how big the TeX distribution is!
>I can't go tying up a 9600bps modem with a giant transmition like
>that...
>
>Larry? 5.0? Please.
>

If something like that will be added I'd prefer to have the unexec stuff from
GNU emacs compiled in by default (if available for that machine). 

Are there machines that can undump, but not unexec? Or the other
way around? Which set is bigger?

For instance, HP PA-RISC can unexec but there isn't any
undump available (to my knowledge).

	Jan D.

Newsgroups: comp.lang.perl