HDTenEightyP/NetNews huggingface dataset:
From: mab@wdl39.wdl.loral.com (Mark A Biggar)
Subject: Re: Recursive 'walk' into dir
Organization: Loral Western Development Labs
Date: Wed, 7 Oct 1992 16:41:17 GMT

In article <1992Oct7.071846.21487@lth.se> dat91uni@ludat.lth.se (Urban Nilsson) writes:
>It wouild be nice if it did a recursive walk into the sub directories ...
>Is this possible in perl ?!? if so please show me how !

Look at find.pl in the library of perl routines that came with the
perl distribution.  The commentary at the front of the file explains
how to use it.  You may also want to look at 'find2perl', which takes
command line arguments that look like those to 'find' and generates an
equivalent perl script that does what the find comand would have done.
Also piping find output into a oneliner perl script is often the most
convenient way to do simple dir-tree walking tasks, for example the following
command line walks the tree below the current directory and deletes all
emacs backup files:

find . -name '*~' -print | perl -ne 'unlink chop;'

--
Perl's Maternal Uncle
Mark Biggar
mab@wdl1.wdl.loral.com
From: cjross@bbn.com (chris ross)
Newsgroups: comp.lang.perl
Subject: Re: OOP?
Date: 10 Oct 1992 00:35:27 GMT
NNTP-Posting-Host: bbn.com

imp@solbourne.com (Warner Losh) writes:

>Has anybody given any thought to an object oriented perl?

You have pointers, therefore you can OOP.
Whatsa problem?   ;-)

No, really!  Packages are classes.  Objects are names; get at
instance vars of *name by $name{"variable"}, class methods by
*class = $name{"class"}, $method = $class{"method"}, ditto for
superclass pointer.

$gensym = 'aaaaa00000';

sub new {
    local($type) = @_;
    eval "$type'new(++\$gensym);"
}

etc, etc.

[At this point, the watching tribesmen begin yelling and
shaking their spears threatingly.  Chris shuts up.]


chris ross   <cjross@bbn.com>   BBN Advanced Simulations   (617) 873-3272
 WARNING: article may contain flammable material.  Do not expose to open
   flames.  In case of accidental ignition, douse keyboard with water.
Newsgroups: comp.lang.perl
From: dbrillha@dave.mis.semi.harris.com (Dave Brillhart)
Subject: Is 'x' contained within a list
Date: Wed, 14 Oct 1992 12:33:39 GMT
X-Newsreader: TIN [version 1.1 PL6]
Reply-To: dbrillha@dave.mis.semi.harris.com
Organization: Harris Semiconductor

What is the most efficient method of determining if string
'x' is in a list of strings.

What I am doing is iterating through the password file and
processing the row if the current account is in a list
of targeted accounts.

My first (very slow!!) approach was to 'pop' each account off
the target list and compare with the current row. Repeat for
each line in the password file.

Ideally, a function like: is_in(x,@list) would return true
if x was in the list.

Thanks for considering this....

--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 Dave Brillhart                              Harris Semiconductor
 dbrillha@dave.mis.semi.harris.com           Mail Stop 62A-024
 Voice: (407) 729-5430                       P.O. Box 883
 Fax:   (407) 724-7486                       Melbourne, FL 32902-0883
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: local() bug?
Originator: tchrist@pixel.convex.com
Date: Sat, 17 Oct 1992 04:13:48 GMT
Distribution: na
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 kherron@ms.uky.edu (Kenneth Herron):
:The following prints "5":
:
:	sub testit {
:		$_[0] = 5;
:	}
:	&testit($foo);
:	print $foo, "\n";
:
:so does this:
:
:	sub testit {
:		local($bar);
:		$_[0] = 5;
:	}
:	&testit($foo);
:	print $foo, "\n";
:
:But the following prints a blank line:
:
:	sub testit {
:		local($foo);
:		$_[0] = 5;
:	}
:	&testit($foo);
:	print $foo, "\n";
:
:Bug, or nonobvious-from-the-docs feature?

Yup, this is known, but I don't know of any plans or strategies 
for fixing it.  It's certainly non-obvious from the docs.  It's 
a ramification of the pass-by-reference and dynamic scoping 
properties.  

The way it works is you pass in $foo.  What is passed is a pointer
to the thing named $foo.  By saying local($foo), you change the
thing $foo.

It's a pretty suboptimal thing in my book.

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

    The autodecrement is not magical.
            --Larry Wall in the perl man page
From: joel@abigale.UUCP (Joel Rosi-Schwartz)
Newsgroups: comp.lang.perl
Subject: Re: SCO w/Perl trouble
Date: 10 Oct 92 09:55:51 GMT
Organization: Techne Research, Finchampstead, Berkshire (UK)

In article <Bvt3yK.2CD@melpar> alex@tsmnet2.uucp (Alex Mason) writes:
>I'm having trouble getting perl-4.035 to run on a SCO 3.2.2 box.
>The symptoms are memory fault(core dump) after running make test
>at the end of compilation. The possible variables I see are I do
>have crypt support (I ended up specifying -lcrypt_d) and the fact
>that I took out the -ldir reference that Configure was looking for
>because the linker complained that it could not find it.
>Other than that, I took all the default parameters. Has anyone
>had problems with SCO?


Hi,
Since I have received no response to my posting on this question
a week or so ago, I'll give it another shot:

More to the general point is that I have had a well running perl on SCO
from PL19...PL35 and would be happy to do any or all if the following.

    a.  If anyone sent me disks or a tape, or is willing to reimburse
        for the them, I would be happy to "distribute" SCO perl to them.
        This will take one 1.4Meg disk for the binaries and a 2 more
        if you desire all the soucre also.  I can cut 150Meg (DC6150)
        tapes.

    b.  If someone has an ftp archive site I could up-load this to,
        please let me know where and how.  I am not directly on ftp.
        I use the good graces of my wife's physics department at the
        U. of Reading (UK), so I can not act as an accassible archive.

    c.  As a special inducement for ordering your copy _today_ I will
        throw in, for just the cost of reproduction, a copy of the
        perl manual done in TeX and spiral bound.  This document is
        a bit behind at PL19, but still quite useful and pretty.
        If anyone is interested I  will check the printing/binding
        costs and let you know, but I would guess it to be about
        10 Pounds.

        The TeX'ing is the fine work of:

        GNU Texinfo version adapted by Jeff Kellem
        <composer@@Beyond.Dreams.ORG>.
        Copyright 1989, 1990, 1991 Larry Wall
        Texinfo version Copyright 1990, 1991 Jeff Kellem
        Perl Manual (Texinfo version)
        For perl version 4.0 patchlevel 19
        Edition 0.5, dated 04 December 1991
        Texinfo version by Jeff Kellem <composer@@Beyond.Dreams.ORG>

Cheers,
Joel
-- 
     ==================================================================
     ||               T E C H N E   R E S E A R C H                  ||
     ||  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  ||
     ||                     Joel Rosi-Schwartz                       ||
     ||   Hildorien House            +   Email: joel@abigale.UUCP    ||
     ||   12 Waverley Way            +    (pyrltd!abigale.UUCP!joel) ||
     ||   Finchampstead, Wokingham   +   Phone: +44 (734) 730.260    ||
     ||   Berkshire RG11 4YD (UK)    +   Fax:   +44 (734) 730.272    ||
     ==================================================================
From: markus@mwhh.hanse.de (Markus Witt)
Newsgroups: comp.lang.perl
Subject: PL35 on ISC 3.0 and Sinix 5.41: Regexp problems
Date: 15 Oct 92 21:16:01 GMT
Organization: Nothin' is organized here.

Hi.

I've trouble getting Perl 4.0 PL35 to work properly under two
operating systems, that is Interactive UNIX Version 3.0 (SV.3.2)
and Sinix 5.41.

On both of these systems I get Perl compiled flawlessly (not very
on Sinix, there was a little trouble, but nothing serious).
But both of them don't pass the regexp test. Does anybody know what
could cause this? Has anybody compiled Perl PL35 on one or both of
these platforms and did it pass all tests?
After running into trouble with PL35, I tested PL0 and PL10. PL0
passed all tests on both machines, PL10 did not.

Would it be helpful for answering my questions if I posted the
config.sh of both configurations (ISC + Sinix, PL35 of course) ?

BTW, there is one option sysvr4 in Configure that seems to change
nothing. Why is it in there?

We have to get Perl working ASAP, at least on Sinix,
so any hint how to solve our problems is much appreciated,
thanks in advance,
    Markus
-- 
                        Markus Witt, Hamburg (Germany)
          markus@mwhh.hanse.de      ...!uunet!mcsun!unido!mcshh!mwhh!markus

            "Oh freddled gruntbuggly ... thy micturations are to me /
     As plurdled gabbleblotchits on a lurgid bee" -- Prostetnic Vogon Jeltz
Newsgroups: comp.lang.perl
From: peppe@ipgaix.unipg.it (G. Vitillaro)
Subject: perl under AIX/370 1.2.1
Summary: perl (pl035) under AIX/370
Keywords: AIX/370 perl 1.2.1
Organization: Universita' di Perugia
Date: Thu, 08 Oct 1992 15:25:15 GMT

Anyone tried to compile per 4.035 under AIX/370 1.2.1 (update
level 600)?
I would like to share some experience and put some question.
Thank in advance for any help,
G.Vitillaro
-- 
Giuseppe Vitillaro - IBM SEMEA      |  E-Mail : peppe@ipgaix.unipg.it 
University of Perugia Italy         |  06100 Perugia  Phone:+39.75.585-2200
---------------------------------------------------------------------------
All comments/opinions are mine and don't represent those of IBM
Newsgroups: comp.lang.perl
From: hens@snipe.cray.com (Tom Stephens)
Subject: Re: Why I am glad I know perl
Organization: Cray Research, Inc.
Date: 7 Oct 92 15:34:32 CDT



> 
> System administrators, at least those who are worth their salt, do
> not enter "rm *" as root unless they mean it.    As wonderful as perl
> may be, it's no substitute for extraordinary care when one is su'd.
> 
> Anachronistically still using awk, sed, and the rest,
> ---Rsk


Soooooo correct.  When I did sys admin I *always* did ls -l * before doing a rm *.
--
---------------------------------
Tom Stephens
Corporate Computing and Networks, Chippewa Falls, WI
Cray Research Inc.  hens@cray.com
From: dansmith@Autodesk.COM (Daniel Smith)
Newsgroups: comp.lang.perl
Subject: Re: more readable perl :-)
Date: 15 Oct 92 20:28:31 GMT
Organization: Autodesk Inc., Sausalito CA, USA

> via this definition:

>     sub isn't_foobled { !&is_foobled }


		ain't(&bad) unless you've(&broken_apostrophe_key);  :-)

				Daniel
-- 
     Daniel Smith, Autodesk, Sausalito, California, (415) 332-2344 x 2580
	      Disclaimer: written by a highly caffeinated mammal
	    dansmith@autodesk.com            dansmith@well.sf.ca.us
Organization: Stanford Linear Accelerator Center
Date: Friday, 16 Oct 1992 13:18:49 PST
From: Bebo White <BEBO@SLACVM.SLAC.STANFORD.EDU>
Newsgroups: comp.lang.perl
Subject: Perl Speaker Wanted

I would like to invite someone who is heavily involved in the development
of Perl to participate in the REXX Symposium scheduled for May, 1993 in
San Diego, CA. There is a great deal of interest amongst the participants
in past symposia in Perl and how it compares (and can co-exist) with REXX.

Our dream session would be one involving Mike Cowlishaw (the author of REXX)
and Larry Wall (who has failed to respond to my e-mail) discussing the
development of their respective language.

Please respond to this posting via e-mail in that I suspect that its
subject matter may not be of general interest to the readers of this group.

Thank you very much for your consideration.

Bebo White
Program Committee, REXX Symposium
Stanford Linear Accelerator Center
Stanford, CA
Newsgroups: comp.lang.perl
From: bill@Celestial.COM (Bill Campbell)
Subject: Taintedness problems from su shell.
Organization: Celestial Software, Mercer Island, WA
Date: Wed, 14 Oct 1992 16:17:21 GMT
Summary: -S header doesn't work.
Keywords: setuid, su


I'm having problems with 4.035 when running perl programs from a
shell after su'ing to root.  I get 'No -S allowed in setuid
scripts.  I have this header in the file:

:
#!/usr/local/bin/perl
eval ' exec /usr/bin/perl -S $0 "$@" '
	if $running_under_some_shell;

I could replace this with #!/usr/local/bin/perl and it would work
on this system (SCO ODT 2.0), but I want to maintain portability
with other systems that don't properly support #!.

I want to be able to have a root xterm (scoterm) window for
maintenance functions without having to back out of the entire
X-session or switching multi-screens, and there's no way that I
know to fiddle uid euid stuff before invoking the first line of
the script.  I suppose I could rlogin as root, but that seems a
bit extreme to solve what shouldn't be a problem in the first
place.

I just did a bit of further testing and find that the program
will work UNLESS invoked by another perl program where I've done
something to the effect:
	local($PATH) = $ENV{'PATH'};
	$ENV{'PATH'} = $PATH;
	$< = $>;    # make it ignore taintedness

where I was trying to get perl to stop protecting me from myself!

This problem didn't show up on 4.010 (I skipped 4.019 because of
some of the regexp bugs).

Bill
-- 
INTERNET:  bill@Celestial.COM   Bill Campbell; Celestial Software
UUCP:   ...!thebes!camco!bill   6641 East Mercer Way
             uunet!camco!bill   Mercer Island, WA 98040; (206) 947-5591
SPEED COSTS MONEY -- HOW FAST DO YOU WANT TO GO?
Newsgroups: comp.lang.perl
From: ian@unipalm.co.uk (Ian Phillipps)
Subject: Re: Recursive 'walk' into dir
Organization: Unipalm Ltd., 216 Cambridge Science Park, Cambridge CB4 4WA, UK
Date: Wed, 7 Oct 1992 22:04:29 GMT

Tom Christiansen <tchrist@convex.COM> writes:

>From the keyboard of mab@wdl39.wdl.loral.com (Mark A Biggar):
>:find . -name '*~' -print | perl -ne 'unlink chop;'

>No, that's not legal perl.  You mean

Sure, it's legal. It just doesn't do anything interesting. Unless you
have a file called "\n", that is :-)

Ian

-- 
Ian Phillipps, Unipalm Ltd, 216 Science Park,		Phone +44 223 420002
Milton Road, Cambridge, CB4 4WA, England.		Phax  +44 223 426868
	print unpack( u,q,9:G5S="!A;F]T:&5R('!E<FP@:&%C:V5R"@``,.'');
Newsgroups: comp.lang.perl,alt.religion.kibology,rec.pets.cats,alt.irc,unt.general
From: cgw@sol.acs.unt.edu (christopher williams)
Subject: Perl comes home
Originator: cgw@sol
Organization: University of North Texas
Date: Sun, 11 Oct 1992 05:09:25 GMT

Er, not THAT perl. Perl the kitty!

Julia and I rescued a kitten from the Hartfelt Human Society (a non-
kill animal shelter). She's tiny gray, fuzzy, and still a little bit
wobbly, hence the name "Perl" (well, ok: perl isn't tiny ;-)). She got
a bath and some dinner and has been asleep for about an hour and a half
now.

-cgw-

--
christopher williams   cgw@unt.edu  +1 817 565 4161  Just a guy
lead programmer/operator, university of north texas  made of dots and lines.
Newsgroups: comp.lang.perl
From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
Subject: Re: Something I couldn't figure out how to do with associative arrays
Organization: Motorola Codex, Canton, Massachusetts
Date: Fri, 16 Oct 1992 15:24:55 GMT

larry@st-andy.uucp (Larry Martell) writes:

>I needed to produce a report with three sets of data. All the sets were of
>the form date, value (e.g. 19921015 1234.56). So like a good perl programmer
>I loaded up three associative arrays. But then I found out they wanted the
>report to look like this (any one of the sets can be of any length):

>       DATA 1	 	   DATA 2	       DATA 3
>   DATE     VALUE      DATE     VALUE	    DATE     VALUE
>   ----	    -----      ----     -----	    ----     -----
>  date1-1  value1-1   date2-1  value2-1    date3-1  value3-1
>  date1-2  value1-2   date2-2  value2-2    date3-2  value3-2
>  		      date2-3  value2-3
>  		      date2-4  value2-4

>Since the data was in associative arrays I couldn't figure out out to print it
>like that. I changed my program to use six regular arrays, so I could walk them
>at the same time. 

>Is there a way I could have produced the report as requested while still using
>associative arrays?

How about something like this:

	$i = 0;
	for (sort keys %data1)
	{
	    $table[$i++] = sprintf("%-7s  %-8s", $_, $data1[$_]);
	}
	$i = 0;
	for (sort keys %data2)
	{
	    $table[$i] .= " " x (20 - length($table[$i]));
	    $table[$i++] .= sprintf(" %-7s  %-8s", $_, $data2[$_]);
	}
	$i = 0;
	for (sort keys %data3)
	{
	    $table[$i] .= " " x (40 - length($table[$i]));
	    $table[$i++] .= sprintf(" %-7s  %-8s", $_, $data3[$_]);
	}
	print <<EOH;
     DATA 1              DATA 2              DATA 3
 DATE     VALUE      DATE     VALUE       DATE     VALUE
 ----     -----      ----     -----       ----     -----
EOH
	for (@table)
	{
	    print $_, "\n";
	}

Another approach, which works well if the data is not easy to access in an
ordered way, is to pre-build an empty table representing the output lines, like
this:

	@table = (" " x $columns) x $rows;

and then use substr to fill in the cells:

	sub putcell
	{
	    local ($row, $col, $val) = @_;
	    substr($table[$row], $col, length($val)) = $val;
	}

Strip the trailing spaces before printing:

	for (@table)
	{
	    s/ +$//;
	    print $_, "\n";
	}

Michael.
Newsgroups: comp.lang.perl
From: zh@nike.rz.uni-konstanz.de. (Z. Horvat)
Subject: Sockets again...(Perl-Bug?)
Keywords: Sockets
Reply-To: zh@nike.rz.uni-konstanz.de.
Organization: Rechenzentrum Universitaet Konstanz
Date: Thu, 15 Oct 1992 08:32:07 GMT

First, thanks to the people who responded to my first question about sockets w/ perl.

One thing i noticed is that the following code will work:

$localhost = "my.host.name.here";
($name, $foo, $foo, $foo, $localaddr) = gehostbyname($localhost);
if ($name eq "") {&quit("Aaaaarrrgggghhhh")}
....
socket(.....
connect(....

But if i code it like this:

($name, $foo, $foo, $foo, $localaddr) = gethostbyname($localhost) || die "Booom!";
....
socket(.....
connect(....

.... then the line containing connect will always fail.
(Of course, the code between the line containing gethostbyname and socket is the same in both cases)

Have i missed something ?? Is this the normal behaviour ??? Just wondering.



---------------------------------------------------
SYS337654 Could not locate coffee - Operator halted 
---------------------------------------------------

Z. Horvat
Rechenzentrum Universitaet Konstanz
++49-7531-88-2405

zh@nike.rz.uni-konstanz.de
rzhorv@nyx.uni-konstanz.de
From: joel@abigale.UUCP (Joel Rosi-Schwartz)
Newsgroups: comp.lang.perl
Subject: Re: Visual
Date: 14 Oct 92 06:32:42 GMT
Organization: Techne Research, Finchampstead, Berkshire (UK)


 [ lots deleted ]

>pomeranz> with short, straight hair.  My apologies to Larry, "Weird Al",

 [ lots deleted ]

Sorry, this _REALLY_ probably does not belong in c.l.p, but then on the
other hand I did not start it all ;-)  But who is "Weird Al"?  I feel
as if I am really out of it and missing a very basic part of life ;-(

Cheers,
Joel
-- 
     ==================================================================
     ||               T E C H N E   R E S E A R C H                  ||
     ||  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  ||
     ||                     Joel Rosi-Schwartz                       ||
     ||   Hildorien House            +   Email: joel@abigale.UUCP    ||
     ||   12 Waverley Way            +    (pyrltd!abigale.UUCP!joel) ||
     ||   Finchampstead, Wokingham   +   Phone: +44 (734) 730.260    ||
     ||   Berkshire RG11 4YD (UK)    +   Fax:   +44 (734) 730.272    ||
     ==================================================================
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: Sorting associative arrays based on the value
Date: 14 Oct 92 18:53:05 GMT
Organization: NetLabs, Inc.

In article <1992Oct12.082906.24636@mel.dit.csiro.au> sfy@koel.mel.dit.CSIRO.AU (Shane Youl) writes:
: This may be a FAQ, but then again...
: 
: I have an associative array $Table{$Name} = $Number which I would like
: to sort by $Number. I have been converting the associative array into an
: ordinary two-d array and using the SUBROUTINE option to sort, but I
: thought that there might be a more elegant solution.

Others have told you how to do that, but note that sometimes you just
want to invert the associative array so you can look things up in the
other direction.  This is easy to do in Perl:

	%inverted = reverse %original;

Larry
From: weingart@inf.ethz.ch (Tobias Weingartner)
Newsgroups: comp.lang.perl
Subject: ARGV parsing
Keywords: argv, parsing
Date: 12 Oct 92 15:08:35 GMT
Reply-To: weingart@inf.ethz.ch
Followup-To: poster
Organization: ETH - Switzerland

Hello all. ;)

I have a quick question.  I find myself doing a lot of this type
of code at the front of my scripts.  I would like it if someone
could show me a better way to do this...

NOTE:  Using getopt.pl is not an option.

if(@ARGV){
	while($i = shift(@ARGV)){
		if($i =~ m/^-s$/){
			$var = shift(@ARGV);
		}

		if($i =~ m/^-server$/){
			$var = shift(@ARGV);
		}

		die "Unknown option $i.\n";
	}
}

Basically, I would like to re-write the two if statements into
one.  Something like:

if(@ARGV){
	while($i = shift(@ARGV)){
		if($i =~ m/^-s[e]?[r]?[v]?[e]?[r]?$/){
			$var = shift(@ARGV);
		}

		die "Unknown option $i.\n";
	}
}


Can this be re-written in a cleaner fashion?

--Toby.
Newsgroups: comp.lang.perl,comp.unix.admin,comp.unix.shell
From: Tom Christiansen <tchrist@convex.COM>
Subject: Rm protection (was: Why I am glad I know perl)
Originator: tchrist@pixel.convex.com
Date: Wed, 7 Oct 1992 16:56:40 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 lwall@netlabs.com (Larry Wall):
:What usually gets me is something like, say, starting to
:type "rm *.old", thinking better of it after typing the *, reaching for
:the backspace key and hitting return instead.

One of the nice features about tcsh as an interactive shell
(not a programming language, of course) is that if $rmstar
is set, it find's mistakes like

    rm * .o

mistakes.

:It only helps a little to be the fastest ^C in the West.

I know.  Rm is too small a program.   Maybe we should use the
GNU version? :-)

:: Anachronistically still using awk, sed, and the rest,
:
:I still use awk and sed all day long too, but I call them Perl.  :-)

I still use Latin frequently, and call it Spanish, French, or whatever. :-)

[Followups to appropriate groups for wherever this thread goes, please.]

--tom

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

    Just don't compare it with a real language, or you'll be unhappy...  :-)
            --Larry Wall in <1992May12.190238.5667@netlabs.com>
Newsgroups: comp.lang.perl