HDTenEightyP/NetNews huggingface dataset:
From: braven@rx.xerox.com (Brian Raven)
Subject: Re: A novice question
Reply-To: braven@rx.xerox.com
Organization: Rank Xerox Ltd.
Date: Mon, 28 Sep 1992 17:48:30 GMT

In article 29365@cs.odu.edu, sastr_a@japonica.cs.odu.edu (RAVI AYYALASOMAYAJULA) writes:
>	Hi
>	
>	I wrote a small perl program (which is included below).
>	The problem with this program is the "chdir " in the line #4 
>	doesn't work. However the chdir in #9 works okay and 
>	consequently in each iteration it is going up one level
>	in the directory structure and finally to the root. Why is
>	that so?
>
>	#!/usr/new/perl
>
>	# all the files in the current directory are directory files
>	@DIRS = `ls -1`; 
>	$i = 0;
>	while($i <= $#DIRS) {
>
>		# this chdir doesn't work
>		chdir $DIRS[$i] || die "can't cd to $DIRS[$i] $!\n"; 
>		$file = `ls -1`;
>		print $file;
>		# this chdir works  okay
>		chdir '..'; 
>		$i++;
>	}
>
>
>
>
>	Sorry if this bothers Perl gurus for its downright noviceNess.
>
>	Thanks in advance.
>
>	Ravi.
>	(sastr_a@cs.odu.edu)
>-- 
>*************************************************************
>Sastry.A.V.R.R            |
>sastr_a@cs.odu.edu	  |  Caffeine, Classical and Computers
>sastry@cmns-sun.think.com |          


Your directoy names all have newlines at the end. Try:

@DIRS = split(/\n/,`ls -1`);


---
Brian Raven,
MC&SE, Rank Xerox Ltd., Welwyn Garden City, Herts., U.K. (+44 707 383576)
email (ignore what it says in the header): bfr.wgc1@rx.xerox.com
----------------------
Rebel Without a Clue

Newsgroups: comp.lang.perl
From: vince@halcyon.com (Vince Skahan)
Subject: trouble in Configure ultrix4.2 uVax
Organization: Northwest Nexus Inc. (206) 455-3505
Date: Sun, 27 Sep 1992 19:09:48 GMT

In trying to upgrade from 4.010 to 4.035 on a uVax running ultrix 4.2,
I noticed some problems with Configure being unable to compile at least
two of the test programs.

Could somebody please e-mail me their config.sh file or any hints
that I've missed that were posted previously.  I'm assuming that there's
no need for me to post a followup since I'm late in upgrading and I'm
certain folks have gotten there already, but I'll do so if anybody asks.

thanks for any help you can provide...

again, it's a uVax running stock ultrix 4.2 (no gnu replacements for
the normal tools, etc.).

-- 
          Vince Skahan				vince@halcyon.com (here)
    vince@atc.boeing.com (work)		    vince@victrola.sea.wa.us (home)
		*** Project Management is often an oxymoron ***
From: ratel@ireq.hydro.qc.ca (Gilles Ratel 8720)
Newsgroups: comp.lang.perl
Subject: write STDOUT or FILE
Date: 27 Sep 92 20:59:20 GMT
Organization: Institut de recherche d'Hydro-Quebec, Varennes, Canada

I would write at terminal or into a file:

Example:
===============================================================================

$term = 1;     # flag 

if ($term)     
  {$output = STDOUT;} 			    # define $output at "terminal" O.K.
else 					    # else
  { open(UNIT,'>file.out') || die "??";     # define $output at "file.out" ???
     $output = UNIT;                        #   NOT OPERATIONNAL ????
  }

#----------------------------------------------
$TEXT = ' zzzzzzzzzz';
$~    = outext;				    # write with format "outext"
write ($output);                            # use $output
#----------------------------------------------
format outext =
           @<<<<<<<<<<<<<<<<<<<<<<<<<<<
           $TEXT
.

=============================================================================

Do you have a hint for my "else" ("file.out") ?

Thank you,


Gilles Ratel
Institut de recherche d'Hydro-Quebec
Varennes, QC, CANADA  J3X 1S1
Email: ratel@ireq-ccfm.hydro.qc.ca
Newsgroups: comp.lang.perl
From: ehrlich@cs.psu.edu (Dan Ehrlich)
Subject: Using Perl to manipulate UNIX(tm) quota files
Follwoup-To: poster
Organization: Computer Science Department, Penn State University
Date: Tue, 6 Oct 1992 19:34:29 GMT

I need to be able to do massive edits on a UNIX(tm) file system quota file
and would like to do it in Perl if possible.  My biggest obstacle is
building the patterns for pack/unpack so I have munge the quota structure.
Is there a utility that will do this for me or am I fated to do it by hand?

Thanks in advance.
--
Dan Ehrlich - Sr. Systems Programmer - Penn State Computer Science
"Universities should be safe havens where ruthless examination of
 realities will not be distorted by the aim to please or inhibited
 by the risk of displeasure." - Kingman Brewster
Newsgroups: comp.lang.perl
From: wescott@grok67.ColumbiaSC.NCR.COM (Mike.Wescott)
Subject: Re: bug, porting problem, or pilot error?
Organization: "NCR Corp, Columbia, SC"
Date: Wed, 30 Sep 92 18:15:07 GMT

In article <135@eiffel.eiffel.com>, ram@eiffel.com (Raphael Manfredi) writes:
> Quoting wescott@grok67.ColumbiaSC.NCR.COM (Mike.Wescott) from comp.lang.perl:
> |The following causes perl to dump core:
> |
> |	$fin = "/dev/zero";
> |
> |	open(FIN, $fin) || die "can't open $fin\n";
> |
> |	$i = 0;
> |	$r = sysread(FIN, $mpinfo[$i], 169);
> |	print $r,"\n";
> |
> |If the read length is made small enough, core dumps stop.
> |Is an undefined indexed variable not permitted as an argument
> |to read or sysread? Or have I screwed up the port?

> I would imagine you have to pre-extend your strings before attempting to
> call sysread(), since the system call will not do the allocation for you.

Not really.  Simple strings may be undefined and will be extended and
filled.  See the Camel p 167 and p 188. In the simple case, the argument
is allocated space and then filled by the read.

If the case where the element of the array is undefined the arg
evaluated by sysread is actually is (points to) an internal "undefined"
value called str_undef on which STR_GROW won't allocate more space.
Unfortunately, the area pointed to by str_undef, a predefined zero
length string, is blithely filled by the read.  If the size of the
read is large enough something important gets clobbered, or if the
string area is write protected ...


-- 
	-Mike Wescott
	 mike.wescott@ColumbiaSC.NCR.COM
From: przemek@rrdstrad.nist.gov (Przemek Klosowski)
Newsgroups: comp.lang.perl
Subject: Re: what are the two numbers returned by %name in scalar contex?
Date: 2 Oct 92 20:16:10 GMT
	<1992Oct2.130805.23644@news.eng.convex.com>
Organization: U. of Maryland/NIST
In-reply-to: tchrist@convex.COM's message of 2 Oct 92 13:08:05 GMT

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

   From the keyboard of russell@ccu1.aukuni.ac.nz (Russell Fulton):
   :Also is there a better way of finding the number of entries in an
   :associative array than "@k = keys(%table); $n = @k;" ?

   ... in newer patches of perl, simply
       $n = scalar keys %table;
   But be careful about generalizing.
       $n = scalar (5,6,7,8);
   yields 8, not 4, and 

Is that accurate to say that a list in a scalar context returns the last
element, while the array returns its size?

I had the following problem: while reading a file, find a line that
matches a pattern and load several variables if a match is found. My
first try was

if ( ($var1,$var2,$var3) = /(pat1*) (pat2*) (pat3*)/ ) {
	print "match found";
}

but this does not work ( is the 'if' expression evaluates to $var3?).
My next try:

/(pat1*) (pat2*) (pat3*)/ && do {
  ($var1,$var2,$var3) = ($1, $2, $3);
  print "match found";
}

seems to work, but does not look optimal to me. Is there a better way
to write this?

		

--
			przemek klosowski (przemek@rrdstrad.nist.gov)
			Reactor Division (bldg. 235), E111
			National Institute of Standards and Technology
			Gaithersburg, MD 20899,      USA

			(301) 975 6249
From: overby@cray.com (Glen Overby)
Newsgroups: comp.lang.perl
Subject: Re: "Camel" book
Date: 6 Oct 92 00:12:49 GMT
Article-I.D.: hemlock.1992Oct5.191249.1647
Organization: ^$

In article <MERLYN.92Oct1225434@romulus.reed.edu> merlyn@ora.com (Randal L. Schwartz) writes:
>In article <1992Oct1.222219.16922@grouper.mkt.csd.harris.com> wdh@grouper.mkt.csd.harris.com (W. David Higgins) writes:
>   Does having the first printing give one special powers unknown to
>   mortal man?  If so, why hasn't it rubbed off on me ;-)

>No, but it means you're a Perl "old timer". :-)

So what do you call those of us who started using Perl before the Book came
out?  :-)

Manpage Masochists?

This spring I found a HP 9000/320 (an antique itself) that still has perl 1.x
installed.  I think I'll keep the man page as a souvenier!

Glen Overby
From: esulzner@cad645.intel.com (Eric Sulzner)
Newsgroups: comp.lang.perl
Subject: pipe in and out of process
Date: 30 Sep 92 20:02:35 GMT
Distribution: comp
Organization: Design Technology, INTeL Corporation, Santa Clara, CA

I'd like to read from and write to a process.  The Camel text for the
open function says "(You may not have an open command that pipes both in 
and out, though it's easy to build one using the pipe and fork
commands.)"

Would someone please post an example of this?  Thanks.
--
Eric Sulzner	esulzner@cadev6.intel.com	(408)765-4177
Newsgroups: comp.lang.perl
From: bhatiasa@uther.calvin.edu (Sanjay G. Bhatia)
Subject: Docs for PERL Needed.
Organization: Calvin College
Date: Mon, 28 Sep 1992 00:53:43 GMT

Hi everyone,
	I would like to find out more about PERL and was wondering if anyone 
here would know of an ftp site where I could find some introductory documents
about PERL.
	If anyone does, could you please mail me?  Thanks.

Disclaimer:  All Opinions expressed here are solely mine. 

-------------------------------------------------------------------------
			WIDE AWAKE IN AMERICA ...
Sanjay Bhatia	     		|   Calvin College Computer Center
1306, Bemis St. SE   		|   
Grand Rapids			|   bhatiasa@uther.calvin.edu
MI 49506			|   
(616) 459-6319			|
-------------------------------------------------------------------------
--
Disclaimer:  All Opinions expressed here are solely mine.  
	     My Employer(s) are not responsible for what I write.
-------------------------------------------------------------------------
			WIDE AWAKE IN AMERICA ...
From: dyer1@llnl.gov (Kathleen M. Dyer)
Newsgroups: comp.lang.perl
Subject: Re: Perl and CVS
Date: 28 Sep 92 16:48:29 GMT
Article-I.D.: dyer.dyer1-280992093029
Followup-To: comp.lang.perl
Organization: Lawrence Livermore National Lab

In article <1992Sep24.173728.1491@tc.fluke.COM>, inc@tc.fluke.COM (Gary
Benson) wrote:
> 
> In an earlier posting, I mentioned that we are using perl to manage some CVS
> activities. In reply to the many questions asking for more information about
> what we do with Perl in our CVS setup, I thought that instead of answering
> each person individually, I'd post this.
> 

We also use perl to manage CVS. Some of the functions:
  - a thin shell on top of CVS to insure that the local directory structure
    matches that of the repository.
  - a simplistic locking scheme, to very temporarily (a matter of minutes)
lock
    down a repository, as our "commit" process involves more than just the
    commit.
  - automatic tagging of all files which are part of project at every
commit,
    whether or not they were updated.
  - automatic incrementing of the tag after each commit.
  - notification to all team members of commits.
  - scripts to use with loginfo, to manage log file messages.

An earlier version of this system used shell scripts. It was much less 
powerful, and much more difficult to manage. I learned perl specifically
for the purpose of rewriting our system, and thought the effort was well
worth it.

==========================================================================

Kathy Dyer              dyer1@llnl.gov
Lawrence Livermore National Laboratory
From: sdpage@andersen.co.uk (Stephen Page)
Newsgroups: comp.lang.perl
Subject: Latest patch doesn't like starting with a label
Date: 28 Sep 92 17:49:46 GMT
Organization: Andersen Consulting (UK Practice)

Sigh. I only had two Perl programs which I use frequently. BOTH bombed
with bizarre apparent errors in the latest version of Perl after upgrade...
Who said software upgrades were meant to be easy... :-(

I reported the first a week or so ago. Here's the second one:

Works in Perl 4.0.19 on SunOS 4.1:

#!/usr/local/bin/perl
LOGLINE:
while (<>) {
    # lots of code here
    if ($somecondition)
	{ next LOGLINE; }  
    # lots more code here
}

Error when I run it under Perl 4.0.33:

syntax error in file ./foo.pl at line 2, next 2 tokens "LOGLINE:"
Execution of ./foo.pl aborted due to compilation errors.

Fudge to get it working again: insert anything before the label
(e.g. { }).
Newsgroups: comp.lang.perl
From: chare@unilabs.uucp (Chris Hare)
Subject: Re: More headers in mail2news
Organization: UniLabs Research Group
Date: Fri, 2 Oct 1992 02:38:33 GMT

In article <1992Oct1.202146.21208@psc.edu> boone@psc.edu (Jon Boone) writes:
>   I have installed the mail2news script and am successfully
Where can I get this mail2news program?

Thanks!
-- 
????                --- It Always works for me! ---                           
Chris Hare, UNIX Scientist                  Preferred : chare@unilabs.uucp
Just a mild-mannered consultant by day ....
From: tchrist@convex.COM (Tom Christiansen)
Newsgroups: comp.lang.perl
Subject: Re: Install fails - Insecure Path ???
Date: 29 Sep 92 19:11:37 GMT
Article-I.D.: news.1992Sep29.191137.17203
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 neal@ctd.comsat.com (Neal Becker):
:Thanks.  This is really wierd.  I run gnuemacs on hpux.  To get
:loadaverage, I install gnueamcs setgid to sys.  Then when I use emacs
:shell, I've got:
:
:/a/data/src/gnu/perl-4.035% gid
:uid=206(neal) gid=20(users) egid=3(sys) groups=20(users),21(news),24(ftp)
:
:I guess perl doen't like haveing gid != egid.

That's right.

Interesting that emacs let you read other people's mail.  I'll
bet that egid of sys lets you read /dev/mem, after all.

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist
    double value;                /* or your money back! */
    short changed;               /* so triple your money back! */
            --Larry Wall in cons.c from the perl source code
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: ? possible (de)reference nested data types syntax ?
Date: 29 Sep 92 17:53:03 GMT
Organization: NetLabs, Inc.

In article <1a8t6qINNga8@yukongold.cs.ubc.ca> phillips@cs.ubc.ca (George Phillips) writes:
: In article <1992Sep25.152437.7789@colorado.edu> tchrist@convex.COM (Tom Christiansen) writes:
: :From the keyboard of ram@eiffel.com (Raphael Manfredi):
: ::Am I the only one who finds the \ prefix troublesome ?
: :
: :No, I do as well, but don't have a better suggestion, so have
: :kept quiet.
: 
: Perl already lives with potential ambiguities with %, & and *, so why
: not use a >, ? or ^ prefix instead of \?

Several reasons.  ? is already taken for one-shot patterns (though
nobody uses them, even me).   I don't think > or ^ are visually
distinctive enough.  ^ looks too much like ~, and I think I'd prefer to
reserve > for some kind of funky quoting with balanced, inside out
brackets: >foo<.  But the primary reason is that \ already means "hide
the following thing."  In general you don't want to interpolate
references inside double-quoted strings, so it doesn't conflict much
with the use of \ there.  As was pointed out, the only time it might be
a problem is when you're evalling a double-quoted string, and that's
less of a problem than you might think because having references
obviates the need for eval in many cases.

Larry
From: ram@eiffel.com (Raphael Manfredi)
Newsgroups: comp.lang.perl
Subject: Re: bug, porting problem, or pilot error?
Date: 28 Sep 92 20:11:14 GMT
Organization: Interactive Software Engineering, Santa Barbara CA

Quoting wescott@grok67.ColumbiaSC.NCR.COM (Mike.Wescott) from comp.lang.perl:
|The following causes perl to dump core:
|
|	$fin = "/dev/zero";
|
|	open(FIN, $fin) || die "can't open $fin\n";
|
|	$i = 0;
|	$r = sysread(FIN, $mpinfo[$i], 169);
|	print $r,"\n";
|
|If the read length is made small enough, core dumps stop.
|Is an undefined indexed variable not permitted as an argument
|to read or sysread? Or have I screwed up the port?

I would imagine you have to pre-extend your strings before attempting to
call sysread(), since the system call will not do the allocation for you.

Try:

	$buf = ' ' x 169;
	$r = sysread(FIN, $buf, 169);
	$mpinfo[$i] = $buf if $r > 0;

Or you may pre-extend the array variable directly. It depends what you
are trying to do.
-- 
Raphael Manfredi <ram@eiffel.com>
Interactive Software Engineering Inc.
270 Storke Road, Suite #7                      / Tel +1 (805) 685-1006 \
Goleta, California 93117, USA                  \ Fax +1 (805) 685-6869 /
From: kentd@FtCollins.NCR.com (Kent Dalton)
Newsgroups: comp.lang.perl
Subject: Perl 4.035 - Amiga Port is now available for anonymous ftp
Date: 29 Sep 92 08:58:22 GMT
Reply-To: Kent.Dalton@FtCollinsCO.NCR.com
Followup-To: poster
Distribution: world
Organization: NCR Microelectronics, Ft. Collins, CO


This was orignally posted to comp.sys.amiga.announce, hence the kind of
funky format and perl introductory material. 

--

TITLE

    Perl

VERSION

     Perl version: 4.035  Amiga port version: 0.1.0


DESCRIPTION

    This is a port of the perl programming language by Larry Wall
    to the Amiga series of personal computers.

    For those of you who may not be familiar with perl, it is a
    programming language that has become very popular among users
    of the Unix operating system.  The language is very useful
    for the manipulation of text, files, and processes and the
    syntax is very C-like.  Perl is interpreted, which can be
    very convenient when developing small utilities and one-shot
    scripts.


REQUIREMENTS

      o  Amiga OS 2.04 or higher is absolutely required!  Do not
         send e-mail asking about 1.3 and below support.  Any such
         requests will be silently ignored.

      o  An absolute minimum of 1Mb of memory is required to use
         perl.  At least 3Mb is recommended for executing non-trivial
         scripts along with background processes and spawned processes.
	 In general, the more RAM you have, the better.

      o  A hard disk is strongly recommended.  Perl will probably
         be pretty worthless without one.

      o  A complete GCC 2.2.2 installation is recommended (but not required).
         It comes with a lot of the support stuff needed by perl (making
         perl easier to install) (ixpipe, ixemul, etc) and you can
         use it to hack the source (see 'Hacking' section of the Amiga guide
         in the distribution)!

HOST NAME

    amiga.physik.unizh.ch
    wuarchive.wustl.edu

DIRECTORY

    /amiga/new                     -- on physik
    /amiga/devel

    /systems/amiga/incoming/devel  -- on wuarchive

FILE NAME

    perl4.035.V010.lzh
    perl4.035.V010.bin.lzh

    The 'bin' archive contians only the binaries necessary for
    installing and running perl. The other archive contains the
    binaries plus source.
 
DISTRIBUTABILITY

    Perl and its source code are freely redistributable under either
    the GNU General Public License or the Larry's Artistic license.
    Both are discussed in the files contained in the perl distribution.
--
/**************************************************************************/
/* Kent Dalton                   * EMail: Kent.Dalton@FtCollinsCO.NCR.COM */
/* NCR Microelectronics          * Phone: (303) 223-5100 X-319            */  
/* 2001 Danfield Ct. MS470A      *   FAX: (303) 226-9556                  */
/* Fort Collins, Colorado 80525  *                                        */
/**************************************************************************/
An INK-LING?  Sure -- TAKE one!!  Did you BUY any COMMUNIST UNIFORMS??
From: matthew@sunpix.East.Sun.COM (Matthew Stier - Sun NC Development Center)
Newsgroups: comp.lang.perl
Subject: wrapman
Date: 5 Oct 92 18:41:21 GMT
Organization: Sun Microsystems, Research Triangle Park, NC
NNTP-Posting-Host: troi.east.sun.com


I'm using a version of wrapman that understands perl and borne shell scripts.
(# $Header: /vol/local/share/bin/RCS/wrapman,v 1.11 1992/01/05 14:12:43 sk )

Works great, but has one minor annoyance.  [NT]roff insists a printing a blank
page on scripts that have some length to them (I get two page 1's.  The first
consisting only of a footer, and the second is the first page of the document.)

Any fixes/workarounds for this.  The manuals I have on [tn]roff don't show how
one can reset to begining of page, which is what roff code needs to do.
(i.e.: throw away everything, and restart on the current page.)


-- 
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  | 
Newsgroups: comp.lang.perl
From: chip@tct.com (Chip Salzenberg)
Subject: Re: ? possible (de)reference nested data types syntax ?
Date: Wed, 30 Sep 1992 20:45:30 GMT
Organization: TC Telemanagement, Clearwater, FL

According to lwall@netlabs.com (Larry Wall):
>? is already taken for one-shot patterns (though nobody uses them,
>even me).

I do!  I do!

[insert chewing gum commercial here]
-- 
Chip Salzenberg at Teltronics/TCT  <chip@tct.com>, <73717.366@compuserve.com>
    "My favorite phenomenon is when someone mails me or posts to this
     group, either calling me a newbie or telling me that my postings
     are not relevant to alt.non.sequitur."           -- Matt Welsh
Xref: sparky comp.lang.perl:6361 comp.unix.admin:5404
From: ehrlich@colossus.cs.psu.edu (Dan Ehrlich)
Newsgroups: comp.lang.perl,comp.unix.admin
Subject: Why I am glad I know perl
Date: 6 Oct 92 15:50:52 GMT
Article-I.D.: cs.BvpIos.9Ew
Organization: Computer Science Department, Penn State University

Here is just one reason why every system administrator should know perl.

Scenario:  Sitting in a window on a standalone workstation as root.

           Enter "rm *" assuming that I am in /foobar/blech/bin.

           Notice that I must have been in /bin because "ls" no longer
           exists.  Panic begins to set in.
           
           Confirm that I was really in /bin.  Panic mounts.
           
           Use ftp (from /usr/bin) to suck over some executables from
           a similar workstation.  Hmmm.... Ftp doesn't preserve modes.
           Panic level increasing.
           
           Perl!!  Perl has a built in chmod!
           
           Use echo to construct a script that will set execute bits on
           sh, tar, cat, ls.
           
           Tar up /bin on remote workstations and extract to fully
           restore /bin.
           
           Peace and tranquility have been restored along with /bin.
           Blood pressure returns to normal.  Life goes on.
            
Buy the book.  Read the book.  Learn Perl.

Note that this would not work on a Sun as /bin is a link to /usr/bin and
ftp would have vanished along with everything else.  

-- 
Dan Ehrlich - Sr. Systems Programmer - Penn State Computer Science
"Universities should be safe havens where ruthless examination of
 realities will not be distorted by the aim to please or inhibited
 by the risk of displeasure." - Kingman Brewster
Newsgroups: comp.lang.perl