HDTenEightyP/NetNews huggingface dataset:
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: What's the difference between `command` and system('command')?
Originator: tchrist@pixel.convex.com
Date: Thu, 10 Sep 1992 18:35:30 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 sasswb@unx.sas.com (Scott Bass):
:Sorry for the basic question, but I couldn't find this in the Camel book.

    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>

:What the difference between saying `some Unix command` and
:system('some Unix command')?  Are they synonymous?  Are there situations
:where one is better than the other?

	`cmd`;
	$line = `cmd`;
	@lines = `cmd`;

returns the output, as it does in the shell.  The first form,
however, throws it away.  system() works much (although not
quite exactly) as it does in C.

:Finally, what I need to do is export the DISPLAY variable from a PERL
:script that's submitted via cron.  I was just going to give the
:"export DISPLAY=value" (ksh) command.  If there is a better PERL way of
:doing it, please let me know.

    $ENV{DISPLAY} = $value;
    system $cmd;

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist
As the trials of life continue to take their toll, remember that there
is always a future in Computer Maintenance.
                -- National Lampoon, "Deteriorada"
Newsgroups: comp.lang.perl
Subject: Is the Perl Book available via ftp?
From: marcello@deis20.cineca.it (Marcello Dalpasso)
Date: 14 Sep 92 14:59:46 +0100
Distribution: world
Organization: Dept. of Electronics, Computer Science & Systems, Univ. of Bologna, Italy

Hi netters,

I'm wondering if the Perl Book, "Programming Perl", is available via anonymous ftp.

Thanks
-- 
	Marcello Dalpasso (e-mail: marcello@deis16.cineca.it)
	D.E.I.S. - Department of Electronics, Computer Science and Systems
	Viale Risorgimento 2, I-40136 Bologna, Italy			
	Phone: +39-51-644-3015 (fax: +39-51-644-3073)
From: djbpitt+@pitt.edu (David J Birnbaum)
Newsgroups: comp.lang.perl
Subject: Re: aub problem finding sys/socket.ph
Date: 8 Sep 92 18:08:46 GMT
Organization: University of Pittsburgh

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

>>I have been unable to persuade aub to find my sys/socket.ph file...

>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?

I ran h2ph, redirecting the input from
/afs/pitt.edu/system/pmax_ul4/sys/h/socket.h
and writing the output to
/afs/pitt.edu/usr/djbpitt/lib/perl/sys/socket.ph.

The output file is created properly: the following is the output of
'ls -l /afs/pitt.edu/usr/djbpitt/lib/perl/sys':

total 3
-rw-------  1 djbpitt      2422 Aug 27 19:01 socket.ph

That is, the full pathname is:

/afs/pitt.edu/usr/djbpitt/lib/perl/sys/socket.ph

The /afs/pitt.edu/usr/djbpitt/lib/perl directory was created for me when
I ran 'make install' on perl (and perl then deposited its library files
there). I created the sys subdirectory by hand before running h2ph to
create socket.ph.

I can cut the needed lines out of the socket.ph file and paste them
directly into the aub script, i.e., h2ph did create the appropriate file
with the appropriate data.

Still puzzled,

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: dds@doc.ic.ac.uk (Diomidis D Spinellis)
Newsgroups: comp.lang.perl
Subject: Re: Removing duplicates from an array
Date: 12 Sep 92 12:39:01 GMT
Organization: Department of Computing, Imperial College, University of London, UK.
NNTP-Posting-Host: swan.doc.ic.ac.uk

In article <lb27g1INNaef@jethro.Corp.Sun.COM> tmhoff@oogoody.Corp.Sun.COM writes:
>Is there a cool way of removing duplicates from an array? I can think
>of several methods, it could be an option on sort, but what is the
>perl way?
If you you know that no array element contains a \0 character, then the
following will do the job:

	%a = split("\0", join("\0\0", @a));
	@a = keys %a;

The first line generates a list of key value pairs out of the array.
All the values of the pairs are empty.  The list is then assigned to
the associative array.  The second line extracts the unique keys from
the associative array into the normal array.

Diomidis
-- 
Diomidis Spinellis    Internet: <dds@doc.ic.ac.uk>  UUCP: ...!uknet!icdoc!dds
Department of Computing, Imperial College, London SW7     #include "/dev/tty"
Newsgroups: comp.lang.perl
Subject: Re: REXX compared to perl
From: russell@ccu1.aukuni.ac.nz (Russell Fulton)
Date: Tue, 15 Sep 1992 21:37:54 GMT
Distribution: comp
Organization: University of Auckland, New Zealand.

russell@ccu1.aukuni.ac.nz (Russell Fulton) writes:

>It's a couple of years since I used REXX on a VM system so my experience
>may be out of date (Given the speed at which IBM moves, I doubt it:-)

>Rex did not have Regular expressions, or associtative arrays - two
>things that are the essence of perl. Nor did it have the direct access

Well things have moved in the two years since I worked on VM systems,
either that or my memory has faded. Several people have pointed out that
REXX *does* have associative arrays. 


-- 
Russell Fulton, Computer Center, University of Auckland, New Zealand.
<rj_fulton@aukuni.ac.nz>
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: Religion (was: Re: coding style (was Re: Perl language formatting conventions?))
Date: 11 Sep 92 20:02:27 GMT
Organization: NetLabs, Inc.

In article <1992Sep9.233310.29905@etnibsd.uucp> vsh@etnibsd.uucp (Steve Harris) writes:
: In article <1992Aug27.180029.19638@netlabs.com> lwall@netlabs.com (Larry Wall) writes:
: >
: >That probably just means I need to add a case statement to Perl.  But the
: >minimalist in me rebels.  :-)
: >
: >You want religion, I got religion...
: >
: >Larry
: 
: Amen!
:
: It seems that the Cannonical :-) perl style is most closely related to
: Hinduism -- consider the richness of its mythology and the seemingly
: endless scope of its pantheon, contrasted with the underlying principle
: that the multiciplicity of forms derives from a duality which arises
: from a unity which emerges out of nothingness.

Well, in actual fact, it derives more from a Trinity that is also a
Unity.  Hinduism isn't the only "rich" mythology[1] around, after all...  :-)

I prefer C. S. Lewis's classification of religions into "thick" and
"thin".  And like Lewis, I appreciate a religion that can be approached
in both ways simulataneously.  Something that is Real ought to be simple
enough for the beginner to understand, and too complicated for the
expert to understand.  These are the theological underpinnings of Perl.

: Who says you cannot be a minimalist and have a case statement too!

Are you proposing to throw away the "if" statement instead?  Or are you
merely proposing to redefine the term "minimal"?  :-)

: But what we really want to know is:  do your curlies cuddle up to your elses?

Yes, but my elses don't generally cuddle up to my curlies.  :-)

[Though now we're getting into cultural differences, not theological
differences.  People often confuse the two--probably because most folks
can't tell the difference between an ordinary meme and a theophany.]

Larry

[1] In my lexicon, the term "myth" is not synonymous with "false
story".  It means a story which speaks powerfully to basic human need.
Some myths are "false", and some are "true", and we can debate which
are which.  But historicity is not the primary disinguishing
characteristic of myth.  Torque is.  Authors of all sizes adore torque.
[Though it always helps to have an axle, of course.  :-)]
From: dansmith@Autodesk.COM (Daniel Smith)
Newsgroups: comp.lang.perl
Subject: Re: Camel Book for 5.xxx hardback?
Date: 14 Sep 92 20:52:46 GMT
Organization: Autodesk Inc., Sausalito CA, USA

In <1992Sep7.123132.12862@egh-qc.uucp> pete@egh-qc.uucp (Pete Phillips) writes:
> Well, it'd look nice on your screen, but the whole point of something
> like the perl book on CD would be so that you could use grep, awk, or
> some such utility (only joking here guys ;-) ) to search for
> the types of things you are interested in. So you could find the

	And naturally, there'd be a perl script on the CD to convert
PostScript to raw text :-)

				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
Newsgroups: comp.lang.perl
From: Dov Grobgeld <dov@menora.weizmann.ac.il>
Subject: Regular expression bug?
Reply-To: dov@menora.weizmann.ac.il
Organization: The Internet
Date: Sun, 13 Sep 1992 20:04:57 GMT

I didn't get any replies last time. Perhaps I wasn't clear enough. So
I'll try again.

I would like to match a string of the following format:

    <n>H<n bytes>

where n is a a number in ASCII. Examples of such strings are:

     6Horange
     0H
    16Hthis\nis\na string

I tried matching them with the following regular expression:

    /(\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 (are you listening?), 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"              | |   | |
                                                       _| |_ _| |_




--
                                                        ___   ___
                                                      /  o  \   o \
Dov Grobgeld                                         ( o  o  ) o   |
The Weizmann Institute of Science, Israel             \  o  /o  o /
"Where the tree of wisdom carries oranges"              | |   | |
                                                       _| |_ _| |_
From: jerbil@ultra.com (Joseph Beckenbach {Adapter Software Release Engr})
Newsgroups: comp.lang.perl
Subject: Re: Why Bother To Learn Perl?
Date: 14 Sep 92 18:52:51 GMT
Distribution: usa
Organization: Ultra Network Technologies


	Well, I'm saving Gary Benson's article on "why I use Perl" for the
skeptics within shouting range. 1/2 :-)

	An aside, though:  I thought the main virtues of a programmer were
hubris, laziness, and chutzpah.  No, wait, that was politicians. :-)  Guess
I'll have to change my "old-saws" file.  (Thoughts, Larry, on chutzpah? :-) :-)

		Always willing to leave a (straight) line open,
		Joseph Beckenbach
-- 
----
Joseph Beckenbach	jerbil@ultra.com	408-922-0600 x246
	(speaking from, but not for, Ultra Network Technologies)
Member, Non-Sequitor Club -- we got all our eels in our hovercraft
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: inctree, p. 274 in Programming Perl
Keywords: inctree #include tree
Date: 11 Sep 92 17:45:38 GMT
Organization: NetLabs, Inc.

In article <BuDq2p.GM9@unx.sas.com> bultman@sonny.unx.sas.com (David Bultman) writes:
: 
: I typed in the inctree program in Programming Perl and something is awry.
: (p. 274 in the First edition, I checked the latest edition and the program
:  is identical)
: 
: If anyone has any ideas or previous experience with this, your feedback 
: would be greatly appreciated.
: 
: When I try inctree main.c and main.c looks like,
: -- here --
: #include <stdio.h>
: main()
: {
: }
: -- to here --
: 
: the output is,
: 
: Start program
: main.c
:     /usr/include/stdio.h
: 	/usr/include/sys/stdsyms.h
: 	    
: 		/usr/include/stdio.h  DUPLICATE
: 		main.c  DUPLICATE

This line must be failing somehow:

:         if ($stack[$#stack-1] eq $filename) {  # Leaving file.

The clue is the blank line, and the double indentation to the line after.
The inctree script is looking for lines that match /^# \d/.  It
would appear that something in the cpp output is spoofing it into
thinking it has a valid line directive when it doesn't.  Since the
invalid line directive is processed as a "push", and there's no
corresponding "pop", inctree doesn't return to stdio.h when it should
because stdio.h is buried down at $#stack - 2.

Larry
From: Eric.Arnold@Sun.COM (Eric arnold)
Newsgroups: comp.lang.perl
Subject: ? Perl5 ?
Date: 14 Sep 1992 23:33:47 GMT
Organization: Sun Microsystems, Inc.
Distribution: world
Reply-To: Eric.Arnold@Sun.COM
NNTP-Posting-Host: animus.corp.sun.com


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
have more object-oriented support.)  Every time I've tried to do 
any in-depth programming with emulated struct.s, I've always gotten
into a big mess.

Another thing that would be wonderful (though not as critical) would
be a better interface for linking in your own C routines.  I've added a
NetISAM+DBM-layer set of calls via "usersub", but I found that the
documentation/interface was such that I had to guess at the appropriate
calls for the more complex interactions with "perl" internal objects.

I'd also put my vote in for a "case" statement like "sh" has.  It's
very useful/expressive/concise.  In fact, it's one of my favorite things about
the Bourne shell language.

-Eric

Newsgroups: comp.lang.perl
From: bultman@sonny.unx.sas.com (David Bultman)
Subject: inctree, p. 274 in Programming Perl
Originator: bultman@sonny.unx.sas.com
Date: Thu, 10 Sep 1992 20:25:37 GMT
Organization: SAS Institute Inc.
Keywords: inctree #include tree


I typed in the inctree program in Programming Perl and something is awry.
(p. 274 in the First edition, I checked the latest edition and the program
 is identical)

If anyone has any ideas or previous experience with this, your feedback 
would be greatly appreciated.

When I try inctree main.c and main.c looks like,
-- here --
#include <stdio.h>
main()
{
}
-- to here --

the output is,

Start program
main.c
    /usr/include/stdio.h
	/usr/include/sys/stdsyms.h
	    
		/usr/include/stdio.h  DUPLICATE
		main.c  DUPLICATE

-- cut here ---
#!/usr/local/bin/perl

# Usage: inctree [options] [files]

# Configuration parameters.

printf "Start program\n";

$CPP = 'cc -E';
# $CPP = "cc -P";
# $CPP = "/lib/cpp";

$shiftwidth = 4;

# Process switches.

while ($ARGV[0] =~ /^-/) {

    $_ = shift;
    if (/^-D(.*)/) {
        $defines .= " -D" . ($1 ? $1 : shift);
    }
    elsif (/^-I(.*)/) {
        $includes .= " -I" . ($1 ? $1 : shift);
    }
    elsif (/^-m(.*)/) {
        push(@pats, $1 ? $1 : shift);
    }
    elsif (/^-l/) {
        $lines++;
    }
    else {
        die "Unrecognized switch: $_\n";
    }
}

# Build a subroutine to scan for any specified patterns.

if (@pats) {
    $sub = "sub pats {\n";
    foreach $pat (@pats) {
        $sub .= "    print '>>>>>>> ',\$_ if m$pat;\n";
    }
    $sub .= "}\n";
    eval $sub;
    ++$pats;
}

# Now process each file on the command line.

foreach $file (@ARGV) {
    open(CPP,"$CPP $defines $includes $file|")
        || die "Can't run cpp: $!\n";
    $line = 2;

    while (<CPP>) {
        ++$line;
        &pats if $pats;  # Avoid expensive call if we can.
        next unless /^#/;
        next unless /^# \d/;
        ($junk,$newline,$filename) = split;
        $filename =~ s/"//g;

        # Now figure out if it's a push, a pop or neither.

        if ($stack[$#stack] eq $filename) {  # Same file.
            $line = $newline-1;
            next;
        }

        if ($stack[$#stack-1] eq $filename) {  # Leaving file.
            $indent -= $shiftwidth;
            $line = pop(@lines)-1;
            pop(@stack);
        }
        else {
            printf "%6d  ", $line-2 if $lines;
            push(@lines,$line);
            $line = $newline;
            print "\t" x ($indent / 8), ' ' x ($indent % 8),
                $filename;
            print "  DUPLICATE" if $seen{$filename}++;
            print "\n";
            $indent += $shiftwidth;
            push(@stack,$filename);
        }
    }
    close CPP;
    $indent = 0;
    %seen = ();
    print "\n\n";
    $line = 0;
}
--- end cut ---
   



-- 
David Bultman, bultman@unx.sas.com	SAS Institute, Inc.
Core Research and Development		SAS Campus Dr, Cary, NC
(919) 677-8000 x6875			27513-2414 USA
From: protofan@marmaduke15.rtsg.mot.com (Mike S. Protofanousis)
Subject: function to compute difference in time
Organization: Motorola Inc., Cellular Infrastructure Group
Distribution: comp
Date: Mon, 14 Sep 1992 19:47:32 GMT

Does anyone have perl code to compute the differce between two `date` commands.

  Mon Sep 14 14:47:44 1992
- Mon Sep 14 14:46:54 1992
==========================
                   50 seconds

I need to know the difference in days/hours/minutes/seconds.

Thanks.
-- 
Mike Protofanousis
protofan@rtsg.mot.com     phone: 708 632-6779 (work)
Newsgroups: comp.lang.perl
From: asherman@laser.fmrco.com (Aaron Sherman)
Subject: Re: What's the Right Way to undump perl on a SPARC?
Reply-To: asherman@fmrco.COM
Organization: I-Kinetics, 19 Bishop-Allen Dr., Cambridge, MA
Date: Wed, 9 Sep 1992 22:00:13 GMT

>>>>> 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.

In the meantime, could someone mail me undump source (I had it once,
but have lost it though the many job-moves).



			-AJS

--
--------
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: dhami@cs.ubc.ca (Mandeep S Dhami)
Subject: Re: class negation broken - OR - what am I doing wrong ?
Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
Date: Thu, 10 Sep 92 00:47:13 GMT

ronys@calisto.robcad.uunet (Rony Shapiro) writes:
>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 my understanding of [^f] ?

Yes. /[^f]/ => there exists at least one match for [^f] in $_.
When $_ is "f\n", /[^f]/ matches "\n", etc. you have to use the
second form (or /f/) to exclude _any_ match with f.

try:
perl -ne  'print if /^[^f]/' file # to exclude beginig with f, etc. and
perl -ne  'print unless /f/' file # to exclude _any_ occurence of f

Mandeep
__________________________________________________________________
"I'm very brave generally," he went on in a low voice:
"only to-day I happen to have a headache."
                                      -- Lewis Carroll
__________________________________________________________________
Xref: sparky comp.lang.perl:5741 sci.classics:685 alt.lang.intercal:90
From: mcovingt@athena.cs.uga.edu (Michael A. Covington)
Newsgroups: comp.lang.perl,sci.classics,alt.lang.intercal
Subject: Re: SCRIPT: Roman numeral conversion
Date: 5 Sep 92 03:53:07 GMT
Organization: University of Georgia, Athens

Common Lisp has a Roman-numeral-producing function built in, doesn't it?

-- 
+ Michael Covington - Artificial Intelligence Programs - U of Georgia - USA 
+ Unless otherwise noted, these are private opinions, not official statements.
+ VOTE NO GEORGIA LOTTERY - we need not imitate mistakes of other states.
From: carmi@ipld01.hac.com (Aviram Carmi)
Newsgroups: comp.lang.perl
Subject: Re: Columnization
Date: 14 Sep 92 18:55:17 GMT
Organization: Hughes Aircraft Company - Canoga Park, CA

In article <1360@minya.UUCP> jc@minya.UUCP (John Chambers) writes:
>> | Consider the example from the manual page:
>> |    ls | paste - - - -
>> | This is supposed to produce four-column output.  It does put the names
>> | four  to a line, but in most directories, they will not be in columns.
>> | There seems to be no options that will produce columnar output.
>> 
>> pr -m -t -w# file1 file2 ...
>> 
>> where # is the width (default 72).  May be System V only.
>
>Several people have suggested something like this, but I don't see any
>way  that  you can use pr to columnize the output of ls like the above
>"ls | paste" command does (but correctly ;-). To do so, you would need
>a  filter  that reads ls's output and writes it into N files, and then
>feed these files to pr, and then remember to delete  the  intermediate
>files.   If you're going to write this filter, well, you might just as
>well have it write a single file (stdout) instead and align the fields
>itself.  So pr doesn't help you at all. If you have to write a program
>to chop up the data into multiple files, it's just as  easy  to  write
>your own program in C or perl to do the entire job.
>

I tried to e-mail but it bounced, so here it goes:

How about:

"ls | pr -l1 -t -w100 -4" 

where 100 is the total width and 4 is the number of columns you want.

Here is sample output from my home directory:
InternetResourceGuide/	 Mail/			  Mitch			   News/
canada/			 emacs/			  fx4bin/		   fx800bin/
perl/			 script/		  src/			   sun4bin/


-avi

--
Aviram Carmi   EMail: carmi@ipld01.hac.com  Phone: (818) 702-3179
               Snail Mail: Hughes Aircraft  M/S 262/C64
                           P.O. Box 7928    Canoga Park, CA 91309-7928


-- 
Aviram Carmi   EMail: carmi@ipld01.hac.com  Phone: (818) 702-3179
               Snail Mail: Hughes Aircraft  M/S 262/C64
                           P.O. Box 7928    Canoga Park, CA 91309-7928
Newsgroups: comp.lang.perl