HDTenEightyP/NetNews huggingface dataset:
From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
Subject: die "foo\0bar"
Organization: Motorola Codex, Canton, Massachusetts
Date: Sat, 10 Oct 1992 15:08:31 GMT

If the argument to "die" has a null character in it, the string gets truncated
at the null character.  Look:

 $ perl -e 'die "foo\0bar"'
 foo at /tmp/perl-ea24562 line 1.

Is this a bug, or a feature?

I'm trying to use "die" and "eval" to do a longjump, and to pass some
information along.  It seems I need to unpack the information, first.  Hmph.

Michael.
From: merlyn@ora.com (Randal L. Schwartz)
Newsgroups: comp.lang.perl
Subject: Re: Visual
Date: 12 Oct 92 07:35:35 GMT
	<ASHERMAN.92Oct9144342@piranha.fmrco.com>
Organization: Stonehenge Consulting Services; Portland, Oregon, USA

In article <ASHERMAN.92Oct9144342@piranha.fmrco.com> asherman@fmrco.com (Aaron Sherman) writes:
   Hmm.... For that matter I've never seem Tom and Randal at ALL. I think
   they're just perl scripts, written by his Wallness. ;-)

Well, I haven't seen Tom or Larry in the last 15 minutes.  Maybe they
*have* been replaced.  Horrors.

Then again, I haven't seen myself all day.  Just my hands and feet.
Maybe I'm a robot now.  That'd explain the sudden urge to find a can
of 10W-40.

for("larry","tom","randal"){ print(("Just another ","Perl ","hacker,")[$i++]);}
--
Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
merlyn@reed.edu (guest account) merlyn@ora.com (better for permanent record)
cute quote: "Welcome to Portland, Oregon -- home of the California Raisins!"
From: tchrist@convex.COM (Tom Christiansen)
Newsgroups: comp.lang.perl
Subject: Re: associating lists with strings
Date: 7 Oct 92 21:46:58 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 tchrist@convex.COM (Tom Christiansen):
:    %table = (
:	'this', *xyz;
s/;/,/
:	'that', *abc;
s/;/,/
:    );

--tom

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


 "All things are possible, but not all expedient."  (in life, UNIX, and perl)
Newsgroups: comp.lang.perl
From: jp@ssc.gov (John Palkovic)
Subject: reading multiple line records efficiently
Organization: Medium Energy Booster Group, SSCL
Date: Tue, 13 Oct 1992 21:58:26 GMT

I have a largish input file that comes in 42 line chunks. Typically
I have 4000 - 15000 input records.  Each line is a number with
leading whitespace. (I'll append an example record).

I want to read each line of each chunk into an array and then do
something with the array. Each 42nd+1 line is the same: ' 36'.
Unfortunately, it is possible for some of the other lines to be
that same string, so I can't set $/ to read the records. :-( I came
up with the following to read the file chunks into the array:

    $lines = 42;
    sub snarf_lines {
	$record='';
	while(<>){
	    last if ($. % $lines) == 0;
	    $record .= $_;
	}
	@hist = split("\n",$record);
	$_;
    }

Is there a more efficient way to do this?

Thanks - John

ps Example input record:

  36
    2.64989E-05
  0.
  0.
   -1.91648E-08
    1.35713E-04
    4.33006
    9.05050E-03
    12036.6
    12036.6
  0.
  0.
  0.
   0.250472
    2.75284E-03
   0.418698
    19.6570
   -4.23084E-03
    1.00000
    1.32495E-05
  0.
  0.
    1.31951E-08
    5.97760E+07
   0.170000
  0.
   -59.7760
  0.
   -7.27555
   -7.58012E-03
  0.
  0.
  0.
  0.
  0.
  0.
  0.
  4
  2
  33
  1
  0


--
jp@ssc.gov  The SSC, the DOE, and the URA are not my mother.
I joined the League for Programming Freedom - send mail to john@phc.org.
"I ask each of you to be intolerant of creeping bureaucracy." - Bob Wilson
Newsgroups: comp.lang.perl
From: difisica@ipdunivx.unipd.it
Subject: Perl for VAX/VMS?
Organization: D.E.I. Universita' di Padova -- Italia
Date: Thu, 8 Oct 1992 12:47:52 GMT

Excuse me if this is a FAQ, but I want know if actually there is 
a porting of Perl to VAX/VMS-based machines, because this is the only
computer i may use.
Thanks in advance.

	Renato Favro
Newsgroups: comp.lang.perl
From: pomeranz@irving.nas.nasa.gov (Hal R. Pomeranz)
Subject: Re: Visual
Organization: NAS, NASA Ames Research Center, Moffett Field, CA
Date: Thu, 8 Oct 92 19:34:24 GMT

In article <djd.718533012@reading> djd@csg.cs.reading.ac.uk (David J Dawkins) writes:
> I don't know about anyone else, but I would sure like to know what 
> Larry, Tom and Randall *look* like :-}

After seeing Larry again at the last Bay LISA meeting, I am confirmed
in my opinion that Larry looks a lot like "Weird Al" with short,
straight hair.  My apologies to Larry, "Weird Al", and anybody else
who may be offended by this opinion.

-- 
===============================================================================
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: jw@peanuts.informatik.uni-tuebingen.de (Joerg Wedeck)
Subject: Re: Building on SunOS 4.1.2 -- Core dump...
Organization: "Lehrstuhl fuer Technische Informatik, Uni Tuebingen"
Date: Thu, 8 Oct 92 18:30:31 GMT

In article <fritz.718476311@Cadence.COM>, fritz@Cadence.COM (Frederick Staats) writes:
|> I've been trying to build perl-4.035 on a Sparc IPX with
|> standard SunOS 4.1.2.  The closest default configuration
|> is "sunos_4_0_2" which leaves me with a version of perl
|> that core dumps on startup.  Could someone send me a working
|> conifg.h?  I have built this version of perl on a RS/6000
|> with AIX 3.2 without problem in the past.
|> 

Try using gcc, I had the same problem under SunOS 4.1.3. When I used gcc
everything worked fine (except 1 test).

-- 
--------------------------------+-------------------------------------
Joerg Wedeck			| E-Mail: jw@peanuts.informatik\
Universitaet Tuebingen		|		.uni-tuebingen.de
Lehrstuhl fuer Techn. Informatik|
Sand 13				|
7400 Tuebingen			|
Germany				|
--------------------------------+-------------------------------------

Newsgroups: comp.lang.perl
From: dhami@cs.ubc.ca (Mandeep S Dhami)
Newsgroups: comp.lang.perl
Subject: Re: associative arrays with variable numbers of fields
Date: 12 Oct 1992 00:48:29 -0700
Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
Distribution: usa
NNTP-Posting-Host: valhalla.cs.ubc.ca

brennan@alc.com (Tom Brennan) writes:
>
> I have a text file of the following format:
> 
> key_value	attribute1	attribute2
> key_value	attribute1
> key_value	attribute3
> key_value	attribute4	attribute5	attribute6
> 
> I would like to read this file into an associative array, but 
> as you can see, there are variable numbers of attribute fields.
> Would this be adviseable? 
> 
> I would like to do processing to answer questions like how many 
> occurances of attribute3 occur in this file. Also, I would like
> do processing which would find which attributes are associated with
> a given key value.
> 

An easy way is to use 2 associative arrays:
while(<FILE>) {
    split;
    $for_key{shift(@_)}=join("\377",@_); # Overwrites repeated values,
				         # Can use .=("\377".join(...))
    grep($for_attr{$_}++,@_);
}

Then you can answer:
1. What are the keys? as:
    print join(' ',sort(keys(%for_key))),"\n";

2. What are attributes of key $X? as:
    print join(' ',split("\377",$for_key{$X})),"\n";

3. What are all the attributes? as:
    print join(' ',sort(keys(%for_attr))),"\n";

4. How many times does attr. $Y occur? as:
    print "$Y occures - ",$for_attr{$Y}||0,"times\n";

Mandeep.
__________________________________________________________________
"I'm very brave generally," he went on in a low voice:
"only to-day I happen to have a headache."
                                      -- Lewis Carroll
__________________________________________________________________
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: writing binary data (beginner's question)
Originator: tchrist@pixel.convex.com
Date: Mon, 12 Oct 1992 01:41:50 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 majidi@rwja.umdnj.edu (Masoud Majidi):
:Dear netters,
:
:I have been trying to store some int as binary data in a file and I thought
:something like the following would work:
:
:syswrite (TO, $value, 4)
:
:where $value is say 5 and 4 is the num of bytes in an integer. But the ascii
:value of data is stored in the file. Could you please somebody tell me what
:am I missing?

    print TO pack("I", $value);

is what you want.  You never get automatic conversion to binary 
data in Perl.  You have to ask for it explicitly.

--tom

-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist
If you want to see useful Perl examples, we can certainly arrange to have
comp.lang.misc flooded with them, but I don't think that would help the
advance of civilization.  :-) --Larry Wall in <1992Mar5.180926.19041@netlabs.com>
Newsgroups: comp.lang.perl
From: jones@chpc.utexas.edu (Bill Jones)
Subject: Re: Perl on Cray
Organization: The University of Texas System - CHPC
Date: Mon, 12 Oct 92 01:09:39 GMT


>Has anyone successfully compiled perl 4.035 on a Cray YMP?
>The config file would seem to indicate that it is possible.
>We have a Cray YMP running Unicos 6.1.  I get lots of
>"not enough stack space" errors when I try to compile it.
>
>Any clues?

The "not enough stack space" error is due to sh running out of
stack space.   You can increase the stack space by adding the 
"-m" parameter in every shell script that use the ". file" sh
command or recompiling sh with a bigger default stack.

I sure wish cray would fix this!

Bill  Jones



Newsgroups: comp.lang.perl
From: Marc Rouleau <mer6g@fuggles.acc.Virginia.EDU>
Subject: Re: NUNEZ postings
Reply-To: mer6g@fuggles.acc.Virginia.EDU
Organization: The Internet
Date: Thu, 15 Oct 1992 13:29:29 GMT

I'm sorry about the bounced digests.  They eluded my sanity checker, which
looks for mail from postmaster, mailer-daemon, etc.  Now it looks for
nunez.

    -- Marc Rouleau
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: associating lists with strings
Originator: tchrist@pixel.convex.com
Date: Wed, 7 Oct 1992 19:17:12 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 majidi@rwja.umdnj.edu (Masoud Majidi):
:Dear netters,
:
:Is there anyway to associate lists with strings other than creating a string
:out of the lists (using join) and then using associative arrays? The problem
:with storing lists as strings is efficiency and I was wondering if there were
:any better solution.

Use pointers:

    @xyz = (1..10);
    @abc = (1..10);

    %table = (
	'this', *xyz;
	'that', *abc;
    );

    *ary = $table{'this'};

    for (@ary) {
	print "$_\n";
    } 

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

    echo "Your stdio isn't very std."
            --Larry Wall in Configure from the perl distribution
Newsgroups: comp.lang.perl
From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
Subject: Re: playing with pointers (beginner's question)
Organization: Motorola Codex, Canton, Massachusetts
Date: Thu, 15 Oct 1992 15:17:57 GMT

majidi@rwja.umdnj.edu (Masoud Majidi) writes:

>I have been learning perl from the camel book for the past month or so
>and apparently that book doesn't cover the pointers in any extent.
>Is there any book that covers some of the more advanced features
>of perl? 

>I have a list of words, say ("cat", "dog", "cat", "cat") and I need to create
>an assosiate array such that: $table{"cat"} be a pointer to (0, 2, 3) i.e.
>pointer to indices of "cat" and $table{"dog"} be a pointer to (1). I wrote
>the following code which doesn't work and I appreciate it if someone could
>give me a hand in fixing it.

>for ($i = 0; $i <= $#words; $i++) {
>	if (defined $table{$words[$i]}) {
>		*ary = $table{$words[$i]};
>		push (@ary, $i);
>		$table{$words[$i]} = *ary;
>	}
>	else {

This next line isn't right.  You want to create a new array at this point,
instead of just using whatever *ary happens to reference.  Try inserting
something like this, here:

		*ary = "gen_" . $word[$i];

>		@ary = ($i);
>		$table{$words[$i]} = *ary;
>	}
>}

Michael.
Newsgroups: comp.lang.perl
From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
Subject: Re: Malformed cmd links -- more info
Organization: Motorola Codex, Canton, Massachusetts
Date: Sat, 10 Oct 1992 16:44:32 GMT

mcook@fendahl.dev.cdx.mot.com (Michael Cook) writes:

>Perl says "Malformed cmd links" when my script finishes.  Has anyone seen
>this before?  Any ideas what it might mean?

>This is perl, version 4.0

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

This script exhibits the problem:

#! /usr/local/bin/perl
&foo;
sub foo
{
    local (*glob);

    *glob = "bar";
    &glob;
}
sub bar
{
    return;
}
__END__

If I take out the "local (*glob)" or the "return;", I stop getting the
"Malformed cmd links" message.

Michael.
Newsgroups: comp.lang.perl
From: jja@fnbc.com (Joseph Alotta)
Subject: how does one tar to stdout? and related?
Keywords: tar,stdout, pipes,redirection
Organization: First National Bank Of Chicago, Chicago IL, USA
Date: Thu, 8 Oct 92 18:44:23 GMT

sorry if this is misposted.  i program in perl, but i like to make
my programs as small as possible, so i read stdin and write stdout and
connect them all with pipes.

i have a problem getting tar to write to stdout.  i can get it to read  
from stdin, but not the other way around.  i have these large files on 
tape and i want to read and subset them before i write them on disk  
because they are really big.  i'd like to do something like:

tar -xvf /dev/rst0  mybigfile | grep "1000" | filter.pl

but tar always writes to disk directly.  how can i fake it out?

another related issue is this:  their are a few programs that insist
on opening a file and reading from it.  some even open a output file and  
write to it.  i want to use them in pipes.  how can i make this pipeable?

someprog   infile.dat  outfile.dat

transformed into:

generate.pl  | someprog /dev/stdin /dev/stdout | grep "result" | etc.pl 


is there some piping perl code that can do these kinds of things?
open2.pl?

thanks,

joe.


--
==============================================================
! joe alotta                                    jja@fnbc.com !                                               
!                                             (312) 732-3439 !
!                                                            !
! "The main thing is to keep the main thing the main thing." !
! Dr. George Sweeney                                         !
==============================================================
From: tchrist@convex.COM (Tom Christiansen)
Newsgroups: comp.lang.perl
Subject: Re: timelocal() ??
Date: 8 Oct 92 16:12:51 GMT
Article-I.D.: news.1992Oct8.161251.11099
Reply-To: tchrist@convex.COM (Tom Christiansen)
Distribution: na
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 frankm@terminator.CNA.TEK.COM (Frank Miller):
:My goodness ... there it is (timelocal.pl)!  Wasn't in the Camel book .
:So, has anyone written RPC support ... what about X calls? 
:Uh...just kidding.

Why kid?  I just posted a hardwired version of rup, which uses RPC 
calls, and Larry is playing with a version of perl linked into X,
which he calls guiperl (to go along with stickyperl, of course.)

--tom

-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist
    No, I'm not going to explain it.  If you can't figure it out, you didn't
    want to know anyway...  :-)
            --Larry Wall in <1991Aug7.180856.2854@netlabs.com>
Newsgroups: comp.lang.perl
From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
Subject: Re: use of rand
Keywords: read
Organization: Motorola Codex, Canton, Massachusetts
Date: Thu, 15 Oct 1992 14:03:07 GMT

yli@acsu.buffalo.edu (Yanhong Li) writes:

>I want to operate on 100 random lines of a file whose length is about
>500 lines, is there an easy way to do that?
>thanx

A 500-line file is probably pretty small (assuming reasonable line lengths).
I'd just slurp the whole file into an array, and go from there:

@foo = <FH>;
@foo = &randomize(@foo);
splice(@foo, 100);	# truncate the list

sub randomize
{
    local (@list) = @_;
    local (@new);

    while (@list)
    {
	push(@new, splice(@list, int(@list * rand), 1));
    }
    @new;
}

Michael.
From: tchrist@convex.com (Tom Christiansen)
Newsgroups: comp.lang.perl
Subject: more readable perl :-)
Date: 13 Oct 92 00:10:20 GMT
Organization: Engineering, CONVEX Computer Corp., Richardson, Tx., USA
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.


I got tired of writing

    if (! &is_foobled($gnap)) 

and started writing 

    unless (&is_foobled($gnap)) 

but am now writing

    if (&isn't_foobled($gnap)) 

via this definition:

    sub isn't_foobled { !&is_foobled }

neat, eh? :-)

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist
    "You can't have filenames longer than 14 chars.  
     You can't even think about them!"
        --Larry Wall in Configure from the perl distribution
Newsgroups: comp.lang.perl
From: braven@rx.xerox.com (Brian Raven)
Subject: Re: Is 'x' contained within a list
Reply-To: braven@rx.xerox.com
Organization: Rank Xerox Ltd.
Date: Wed, 14 Oct 1992 16:16:36 GMT

In article 2581@mlb.semi.harris.com, dbrillha@dave.mis.semi.harris.com (Dave Brillhart) writes:
>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
>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


A couple of ideas spring to mind...

foreach (@list) { $list{$_} = 1;}
if (defined($list{$x}) {...}

.. also,if the list contained regular expressions, I think this might work...

$list = "((" . join(")|(",@list) . "))";
if ($x =~ /$list/) {...}

.. and I bet there's even better ways.

---
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: admerlev@sundae.triumf.ca ( Arnd Merlevede )
Subject: How to read keyboard without blocking ?
Reply-To: admerlev@cipy.e-technik.uni-erlangen.de
Organization: University of British Columbia, Vancouver, B.C., Canada
Date: Wed, 7 Oct 1992 23:35:12 GMT

Hi,
can anybody help me on how I can read the keyboard (/dev/tty)
in a nonblocking fashion ?
I tried read, sysread, getc... but they all wait for 
input. I want the program to continue when no key was pressed.
Thanx for your input
Arnd

--
Any replies appreciated to : Arnd.Merlevede@cipy.e-technik.uni-erlangen.de
I hate to tell you, but you're only being simulated on the new cray !
(sdb: Would you like to save a backup of YOUR coredump ?)
From: joel@abigale.UUCP (Joel Rosi-Schwartz)
Newsgroups: comp.lang.perl
Subject: Re: Visual
Date: 9 Oct 92 10:14:26 GMT
Organization: Techne Research, Finchampstead, Berkshire (UK)

In article <1992Oct8.163247.12618@news.eng.convex.com> tchrist@convex.COM (Tom Christiansen) writes:
>From the keyboard of djd@csg.cs.reading.ac.uk (David J Dawkins):
>:
>:You guys been digitised? 
>
>Nope, but I've been digitized.
>

As an American expatriate living in the UK, I request that we do
_not_ start another across the pond war ;-)

Cheers,
Bye,
Sincerely,
Mit Freundlichem Gru\ss,
Tante grazie,
Ciao,
Met vriendelijke groeten,

Joel

PS -- I would love to have any other common foreign language salutations
and closing to add to my TeX collection.
-- 
     ==================================================================
     ||               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: Need help with a crazy perl 4.035 probl
Date: 7 Oct 92 16:21:50 GMT
Organization: NetLabs, Inc.

In article <1992Oct6.225407.440@cbis.ece.drexel.edu> rickers@ECE.Drexel.EDU writes:
: Also, in original article, I noticed that adding a:
: 	1;
: after the problem line made the error messages disappear.  I don't think
: there is anything significant about the 1;  just that it makes the
: problem line not the last line of the subroutine.

That sounds like it's getting confused about whether the the last line
is in a list or a scalar context.  Is the subroutine you're calling
doing a "require" or a "do" of anything that could turn out to be a null
string?  That's what the weird error messages seem to indicate--it looks
as though it's trying to parse a directory as a script.

Larry
Newsgroups: comp.lang.perl