HDTenEightyP/NetNews huggingface dataset:
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: nuther perl-idiom question..
Originator: tchrist@pixel.convex.com
Date: Tue, 1 Sep 1992 23:27:23 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 kent@manzi.unx.sas.com (Paul Kent):
:in kornshell, one can say:
:
:  x=${foo:-default}
:
:which assigns x the value of foo if foo is defined, and "default" otherwise...

In Perl, one often writes:

    $x = $foo || "default";

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

Besides, it's good to force C programmers to use the toolbox occasionally. :-)
        --Larry Wall in <1991May31.181659.28817@jpl-devvax.jpl.nasa.gov>
From: klr@umbc4.umbc.edu (Kurt Reisler)
Newsgroups: comp.lang.perl
Subject: any success with perl under Interactive 386/ix
Keywords: Help :-)
Date: 25 Aug 92 19:55:35 GMT
Organization: Hadron.com in exile


Has anyone successfully compiled and tested version 4.035 of perl under
Interactive's 386/ix?  Using the "hints" and not optomizing, I am able
to successfully compile perl, but get a core dump when the program
executes.

Any suggestions would be appreciated.

-- 
                Kurt Reisler (UNISIG Chair, DECUS US Chapter)
		  Captain, UNISIG International Luge Team
		     Only a guest at klr@umbc4.umbc.edu
	     Are creative spellings like a patentable life form?
Newsgroups: comp.lang.perl
From: rray@lookout.it.uswc.uswest.com (Randy J. Ray)
Subject: Yet Another Silly Question (YASQ?)
Organization: US WEST Communications, Inc. -- Denver, CO
Date: Tue, 1 Sep 1992 17:17:42 GMT

I have heard it said that nothing can parse perl except perl. Well, I am having
trouble even with that approach!

I am tasked with writing a small (at least, it started small) script to check
the validity of subroutine calls, specifically checking argument number and
type to the actually declaration. At this stage, I am still determining what
rules, or more specifically, execeptions to use in the actual test. That is not
the problem. Neither is extracting the subroutine definitions. That part is
done. I am having trouble parsing out the subroutine calls themselves. I need
to be able to extract the call, and it's list of parameters. Because of the
possibility of passing the result of a subroutine call, it might be a recursive
solution. Then there's the problem of passing the results of operations, like
"keys" or "sort" or others. Has anyone done anything like this? I looked
through the perldb.pl code, hoping to find some parsing clues, but to no avail.

Randy
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Randy J. Ray -- U S WEST IT/CSD         rray@{lookout,uswat}.it.uswc.uswest.com
I'd rather talk religion with Charles Manson than discuss ethics with Congress.
     -me                                                   Phone: (303)595-2852
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Newsgroups: comp.lang.perl
From: muts@fysap.fys.ruu.nl (Peter Mutsaers)
Subject: Re: Simultaneous processes
Organization: Rijks Universiteit Utrecht
Date: Thu, 27 Aug 1992 15:17:40 GMT

>>On 26 Aug 92 14:20:21 GMT, peter@merlin.acadiau.ca (Peter Steele) said:

  Peter> How does one set up simultaneous processes in perl? For example,
  Peter> how would I translate the following into perl:

  Peter>     #!/bin/sh

  Peter>     ls -la > d1 &
  Peter>     ls -la > d2 &
  Peter>     ls -la > d3 &
  Peter>     wait
  Peter>     cat d1 d2 d3 > d4

Use fork+exec to spawn, and wait to wait, something like this:
fork() || (exec "ls -la > d1");
fork() || (exec "ls -la > d2");
fork() || (exec "ls -la > d3");
wait; wait; wait;  # if there are exactly 3 childs

etc
--
_________________________________________________________________________
Peter Mutsaers.         |================================================ 
muts@fys.ruu.nl         |              Memento Mori
Newsgroups: comp.lang.perl
From: weingart@inf.ethz.ch (Tobias Weingartner)
Subject: fork and perl
Followup-To: weingart@inf.ethz.ch
Keywords: fork
Reply-To: weingart@inf.ethz.ch
Organization: ETH - Switzerland
Date: Fri, 4 Sep 1992 16:35:57 GMT


Hello, I have need to fork of a process under perl,
and then have that process modify certain variables
under the parent one.

This does not seem to work. (Thinking about it, make me wonder.)

I.E The following should demonstrate what I need.


$tmp = 1;
print "X - $tmp\n";

if(fork() == 0){
	#
	# Do some timeconsuming task here
	#
	for($i = 0; $i < 10000; $i++){}

	$tmp = 2;
	print "XX - $tmp\n";
	exit(0);
}

print "XXX - $tmp\n";

wait;

print "XXXX - $tmp\n";

exit(0);


This prints out the following:
X - 1
XXX - 1
XX - 2
XXXX - 1

This shows that the child can no longer modify the parents
variables.  Is this even REMOTELY possible, or do implementation
details prevent this?

This is 

perl -v

This is perl, version 4.0

$RCSfile: perl.c,v $$Revision: 4.0.1.4 $$Date: 91/06/10 01:23:07 $
Patch level: 10

Copyright (c) 1989, 1990, 1991, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 4.0 source kit.

--Toby.

Newsgroups: comp.lang.perl
From: todd@uhunix.uhcc.Hawaii.Edu (Todd Ogasawara)
Subject: coding style (was Re: Perl language formatting conventions?)
Organization: University of Hawaii
Date: Thu, 27 Aug 1992 07:21:10 GMT

In article <1992Aug25.214800.10825@netlabs.com> lwall@netlabs.com (Larry Wall) writes:
>In article <DAVE.92Aug25141544@pipi.iis.u-tokyo.ac.jp> dave@pipi.iis.u-tokyo.ac.jp (David Wuertele) writes:
>: What do youse all think?

>That's a religious issue.

>There's only one sure-fire way to be happy.  Do what you know is right,
>and don't expect everyone to like it.

>Larry

I agree with Larry's 2nd statement but am not sure I agree with the first
totally. I admit that "style," by its very nature, has some degree of
individualism. However, I suspect that there might be some way to quantify
some (though not all) aspects of coding style to help programmers make
source code easier for other people to read and interpret (or, for that
matter, for the programmer him/herself at some time in the future).

There were a few journal articles a number of years back trying to
determine how varying indentation size affects code readability (I think
the conclusion was that 4 spaces on a "standard" sized screen was optimal
though I still prefer 8 spaces :-).

There must also be some way to use some of the findings from vision
on processing simple (curved vs. angular) and complex (alphanumeric and
ideographic) images as a tie-in to things like parentheses placement.
One thing I've found over the past few years is that I and some other
people find placing a space after an openning paren and before a closed
paren sometimes adds to the readability of the code (this is not a 100%
rule, it is more like an "i before e except after c except in receive"
rule). E.g., (from C)

	while ((c = getc(fpIn)) != EOF) {
		putc(c,fpOut);
	}
vs.
	while ( ( c = getc(fpIn) ) != EOF ) {
		putc(c, fpOut);
	}

Note that the "paren space" rule is not used 100% of the time in even a
short piece of code like the one shown above.

I also think that the use of parens even when they aren't needed (like the
example above) aids readability. I.e., the code above is equivalent to

	while ( ( c = getc(fpIn) ) != EOF )
		putc(c, fpOut);

Well, as I said I agree with Larry's second point. I don't expect everyone
to agree with what I've said above. I would be interested to hear what
other people think about ways to apply style rules to make Perl and other
kinds of source code easier to read.
--
Todd Ogasawara, U. of Hawaii, Psychology Department
BITNET:		todd@uhunix
INTERNET:	todd@uhunix.UHCC.HAWAII.EDU
Newsgroups: comp.lang.perl
From: asherman@laser.fmrco.com (Aaron Sherman)
Subject: Re: Camel Book for 5.xxx hardback?
Reply-To: asherman@fmrco.COM
Organization: I-Kinetics, 19 Bishop-Allen Dr., Cambridge, MA
	<1992Sep3.014601.28583@news.Hawaii.Edu>
Date: Fri, 4 Sep 1992 18:21:55 GMT

todd@uhunix.uhcc.Hawaii.Edu (Todd Ogasawara) said:

	sherman@unx.sas.com (Chris Sherman) writes:

	>Actually, the Perl book on CD-ROM would be really handy!!!  I
	>would be willing to pay bucks for all the 'animal' O'Reilly
	>books on a CD-ROM. 

Todd> O'Reilly released a Hypercard version of "UNIX in a Nutshell"
Todd> about four or five years ago. I used it quite a bit and found it
Todd> useful and easy to use. I don't have a Mac to use anymore and
Todd> would sure like to see both "UNIX in a Nutshell" and some form
Todd> of a Perl reference for the Microsoft Windows environment using
Todd> the Windows Help engine (or whatever else O'Reilly would prefer
Todd> to use).

I'd like to see them just release it as PostScript(tm) on a CDROM.
That way it's machine independant, and I think most people can get at
a PostScript(tm) previewer, or just print it out (they'd have to write
up the license such that people were allowed to print it out for their
own use, of course.


			-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: >split !!
Summary: use an impossible char.
Keywords: split, \:,
Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
Date: Mon, 31 Aug 92 01:31:31 GMT

> 
> What I am looking for, is something like in lex:
> 
> [^\\]/:	{split();}
> 
> Where the split will only be done if the perceading
> character is not a \.
> 
> Any ideas?
>

Try:
$x='a:b:c\:d:e";     # Or any other way!
$x=~s/\\\:/\377/g;   # Or any other char NOT in input domain
@x=grep(s/\377/\:/g||1,split(':',$x));
             # ^^ or \\\: depending on if you want c\:d or c:d

Also, instead of substituting \: (as in your posting
you may substitute \377 and save a step).

Hope this helps.

Mandeep.
dhami@cs.ubc.ca
--
__________________________________________________________________
"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: jpn@genrad.com (John P. Nelson)
Subject: Re: Ordering indices based on their values
Organization: GenRad, Inc.
Distribution: comp.lang.perl
Date: Thu, 27 Aug 1992 15:19:49 GMT

In article <GLENN.92Aug26122420@capella.clsi.COM> glenn@clsi.COM (Glenn Boysko) writes:
>
>I was wondering if anyone knew of an efficient, simple way to produce an
>ordered array of indices whose order was based on their values.  Consider the
>following array:

Try this:

#!/usr/local/perl

# makeindex subroutine builds and returns a sorted index array.
# argument is a numeric array passed by reference.  To create
# an index for a string array, use "cmp" instead of "<=>"
sub makeindex {
    local(*arr) = @_;
    local(@i) = (0 .. $#arr);

    sort { $arr[$b] <=> $arr[$a] } @i;
}

# test it
@array = ( 7, 2, 4, -1, 5 );
@index = &makeindex(*array);

print "@index\n";


     john nelson

uucp:	mit-eddie!genrad!jpn
domain:	jpn@genrad.com
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: randomize.c
Date: 1 Sep 92 21:03:32 GMT
Organization: NetLabs, Inc.

In article <1992Aug31.183903.4143@cirrus.com> dhesi@cirrus.com (Rahul Dhesi) writes:
: In <AAS.92Aug31133620@rosmer.nr.no> aas@rosmer.nr.no (Gisle Aas) writes:
: 
: >Why not:    perl -e '@l=<>;print splice(@l,rand($#l),1) while @l'

A rand() returns a number *exclusive* of its endpoint, so you'd really want

    perl -e 'srand; @l=<>; print splice(@l, rand @l, 1) while @l'

: I considered using splice and decided not to take the risk of a
: possibly inefficient implementation.  Later I was told that the perl
: book already has such a program.

Unless you know how things are implemented, it's best to try it both
ways and see which is faster.  Most builtins are fairly efficient,
though you can occasionally beat them if you have a problem that's
weird in some way.  This one's weird enough that you might be able
to beat splice by copying the actual strings like you did.  As it happens,
on a sparc the splice wins by about 20%.

In general, you can assume that I haven't been totally stupid.  :-)

: Just how efficient is splice?  I guess it depends on whether arrays in
: perl are internally implemented as linked lists.

Arrays are *not* implemented as linked lists.  That would be tragic.
It would force all subscripting operations (including splice) to be O(n).
Yech.

Arrays are implemented in C as an array of pointers to scalar headers
which in turn point to the actual values.  Splice merely needs to copy
some number of pointers to fill the hole.  It figures out whether to
copy up from the front or down from the back.  It's true that that's
also O(n), or maybe O(n/2) or so, but machines are often optimized to
move blocks of memory quickly, and a splice on the middle of an array
is fairly rare as operations go.  Subscripting, however, happens
constantly, so we optimize for that.

Larry
From: klr@umbc4.umbc.edu (Kurt Reisler)
Newsgroups: comp.lang.perl
Subject: Re: any success with perl under Interactive 386/ix
Keywords: Help :-)
Date: 26 Aug 92 01:42:17 GMT
Organization: Hadron.com in exile

In article <1992Aug25.195535.8042@umbc3.umbc.edu> klr@umbc4.umbc.edu (Kurt Reisler) writes:

( I sure did )

>Has anyone successfully compiled and tested version 4.035 of perl under
>Interactive's 386/ix?  Using the "hints" and not optimizing, I am able
>to successfully compile perl, but get a core dump when the program
>executes.

I feel sort of silly, but on the "last attempt" I changed one thing, and
it compiled and tested perfectly.

I used the hints, strchr instead of index, perl's malloc and -g for
optimization.  The only change was the -g versus no optimizing.  And,
it worked.  Ah well, as slow as that 386 is, it is at least running
perl, like all good Unix systems should :-)

Thanks to all who snickered to yourselves.

-- 
                Kurt Reisler (UNISIG Chair, DECUS US Chapter)
		  Captain, UNISIG International Luge Team
		     Only a guest at klr@umbc4.umbc.edu
	     Are creative spellings like a patentable life form?
From: barr@pop.psu.edu (David Barr)
Newsgroups: comp.lang.perl
Subject: Re: coding style (was Re: Perl language formatting conventions?)
Date: 31 Aug 92 00:49:06 GMT
Organization: Penn State Population Research Institute

In article <9224410.12429@mulga.cs.mu.OZ.AU> ggr@koonda.acci.com.au (Greg Rose) writes:
>In article <1992Aug28.181821.9569@netlabs.com> lwall@netlabs.com (Larry Wall) writes:
>>In article <FAIGIN.92Aug27141558@soldan.aero.org> faigin@aero.org (Daniel P. Faigin) writes:
>>: On 27 Aug 92 18:00:29 GMT, lwall@netlabs.com (Larry Wall) said:
>>: 
>>: > You want religion, I got religion...
>>: 
>>: And you should never argue religion with the son of a preacher. :-)
>>
>>Yes you should.  :-)
>
>Oh, come on, this isn't an argument...

Yes it is!

--Dave
-- 
System Administrator, Population Research Institute    barr@pop.psu.edu
  loose: v. to set free, or adj. not securely fastened.
  lose: v. to miss from one's possession.
From: gkl@tse.uucp (Geoff Loker x656)
Newsgroups: comp.lang.perl
Subject: Looking for listoflists package
Date: 25 Aug 92 16:24:23 GMT
Reply-To: gkl@tse.UUCP (Geoff Loker x656)
Distribution: ont
Organization: Toronto Stock Exchange


I am looking for the listoflists package that was posted about a year or
so ago.  It simulates nested data structures in Perl by using type-globbing.
Unfortunately, I lost my copy of it, and now I need it for an application
I am writing.

If someone out there has a copy of it they could send me, or a pointer to
where it could be found, I would appreciate it greatly.

Thanks.
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: how to get passwd
Date: 3 Sep 92 18:43:43 GMT
Distribution: usa
Organization: NetLabs, Inc.

How many times a month are you going to be doing this?  1928347 times?
100 times?  3 times?  How 'bout:

    $uid = (split(/:/, `tail -1 /etc/passwd`))[2];

Yes, you've got a Swiss Army Chainsaw.  It's not required, even in the
Swiss Army, that you open your marmelade with it.

Larry
Newsgroups: comp.lang.perl
From: mike@meiko.com (Mike Stok)
Subject: Re: change of email address ...
Organization: Meiko Scientific Corp.
Date: Thu, 3 Sep 1992 18:45:51 GMT

In article <1992Sep3.120002.8047@uvaarpa.Virginia.EDU>
bshaw@bobasun.spdc.ti.com writes:
>Say, I enjoy the perl-users digest very much. 
>I have changed email addresses.
>
> [...]
>
>Please change this on your mail list so I can once again
>receive perl digest.

What is the perl-users digest?  What level of perl user is it aimed at?  Can
I try it for a while?

Mike
--
The "usual disclaimers" apply.    | ... many were weak and confused, succumbing
Mike Stok                         | to drink or drugs whenever possible ...
mike@meiko.com                    |
Meiko tel: (617) 890 7676         |                          Hunter S. Thompson
Newsgroups: comp.lang.perl
From: lea%anl433.uucp@Germany.EU.net (Iain Lea)
Subject: Re: any success with perl under Interactive 386/ix
Reply-To: iain%anl433.uucp@Germany.EU.net
Organization: ANL A433, Siemens AG., Germany.
X-Newsreader: Tin 1.1 Beta PL6
Date: Wed, 26 Aug 1992 16:27:49 GMT

Kurt Reisler (klr@umbc4.umbc.edu) wrote:
: 
: Has anyone successfully compiled and tested version 4.035 of perl under
: Interactive's 386/ix?  Using the "hints" and not optomizing, I am able
: to successfully compile perl, but get a core dump when the program
: executes.

I have perl 4.035 up & running on ISC R3.2 v3.0. 

I first compiled it using interactives 'cc' which compiled it ok but 
failed 3 tests (forgot which ones) and then it sometimes dumped core.

I eventually got it to work correctly by compiling with GNU gcc v2.2.2

Iain

--
NAME   Iain Lea 
EMAIL  iain%anl433.uucp@Germany.EU.net
SNAIL  Siemens AG, ANL A433SZ, Gruendlacher Str. 248, 8510 Fuerth, Germany.
PHONE  +49-911-3089-407 (work) +49-911-331963 (home) +49-911-3089-290 (FAX)  
Newsgroups: comp.lang.perl
From: Bob Shaw <bshaw@bobasun.spdc.ti.com>
Subject: change of email address ...
Reply-To: bshaw@bobasun.spdc.ti.com
Organization: The Internet
Date: Thu, 3 Sep 1992 12:00:02 GMT


Hi folks

Say, I enjoy the perl-users digest very much. 
I have changed email addresses.

It is now

bshaw@spdc.ti.com

Please change this on your mail list so I can once again
receive perl digest.

Thanks 
Cheers :-)

Bob

-- 
Nice thing about standards: There are so many of them to choose from.
Bob Shaw Texas Instruments Inc.
13536 North Central Expressway Mail Stop 461  Dallas, Texas 75243
bshaw@spdc.ti.com
------------------------------------
Newsgroups: comp.lang.perl
From: forrie@morwyn.uucp (Forrie Aldrich)
Subject: News poster in perl
Organization: Vision Graphics
			  Dover, NH
			  USA
Date: Sat, 29 Aug 1992 13:08:37 GMT

No responses to the Cnews stuff for perl, so I'll assert the next
question:

Is there a _news_posting_ program (possibly an adaptation of Pnews) written
in perl somewhere?

Thank you...
-- 
	   -----------	      Forrest Aldrich	      -----------
	   -------     morwyn!forrie@unhtel.unh.edu	  -------
	   ----						     ----
	   --	     VISION GRAPHICS --	Dover, NH - USA	       --
	   ------------------------------------------------------
Xref: sparky comp.lang.perl:5656 comp.sources.wanted:4171
From: pete@egh-qc.uucp (Pete Phillips)
Newsgroups: comp.lang.perl,comp.sources.wanted
Subject: Fog index program anybody ?
Keywords: readability scores
Date: 1 Sep 92 12:35:46 GMT
Organization: Surgical Materials Testing Lab (SMTL)


I`m looking for a program which can calculate the Fog index of a
piece of text.
Has anyone written a program to do this ?

(I'd prefer a perl version so I can use it for other things, but any
program will do).

Pete
-- 
Pete Phillips, Surgical Materials Testing Lab, Bridgend, S. Wales.
UUCP   :  uknet!egh-qc!pete            DOMAIN :  pete@egh-qc.co.uk
-----------------------------------------------------------------
"SCIENCE: A way of finding things out and then making them work.  
Science explains what is happening around us the whole time.
So does RELIGION, but science is better because it comes up with 
more understand able excuses when its wrong. There is a lot more 
science than you think."
From: wierda@ltb.ltb.bso.nl (Gerben Wierda)
Newsgroups: comp.lang.perl
Subject: memory problem with test program
Date: 28 Aug 92 13:05:41 GMT
Organization: BSO/LT, Baarn, The Netherlands

We have several perl programs that use a reasonable lot of data in (assoc)
arrays. However, freeing those arrays does not make the memory use smaller. Is
this perl? BSD?

Here is the program and the typical output. The input file has 10000 lines
with info:

=======================snip snip===============================
#! /usr/local/bin/perl

&memory;

open(LIST,"companylist");
@normal = (<LIST>);
close(LIST);
print "Normal array created with ", $#normal+1, " elements\n";
&memory;

open(LIST,"companylist");
while (<LIST>) {
  $assoc{$_} = 1;
}
close(LIST);
print "Associative array created with ", $#normal+1, " elements\n";
&memory;

undef @normal;
print "Normal array undefined\n";
&memory;

undef %assoc;
print "Associative array undefined\n";
&memory;

reset 'a', 'n';
print "Arrays 'a' and 'n' reset\n";
&memory;

open(LIST,"companylist");
@bormal = (<LIST>);
close(LIST);
print "Normal array created with ", $#bormal+1, " elements\n";
&memory;

open(LIST,"companylist");
while (<LIST>) {
  $bssoc{$_} = 1;
}
close(LIST);
print "Associative array created with ", $#bormal+1, " elements\n";
&memory;

undef @bormal;
print "Normal array undefined\n";
&memory;

undef %bssoc;
print "Associative array undefined\n";
&memory;

reset 'b';
print "Arrays 'b' reset\n";
&memory;

sub memory {
  open(PS,"ps -u$$ |") || die "Can't run ps, $!\n";
  while (<PS>) {
    ($user,$pid,$cpu,$mem) = split;
  }
  close(PS);
  print "\tMemory use is $mem%.\n";
}
=======================snip snip===============================
	Memory use is 1.6%.
Normal array created with 10141 elements
	Memory use is 11.5%.
Associative array created with 10141 elements
	Memory use is 15.2%.
Normal array undefined
	Memory use is 15.2%.
Associative array undefined
	Memory use is 15.2%.
Arrays 'a' and 'n' reset
	Memory use is 15.2%.
Normal array created with 10141 elements
	Memory use is 15.3%.
Associative array created with 10141 elements
	Memory use is 15.3%.
Normal array undefined
	Memory use is 15.3%.
Associative array undefined
	Memory use is 15.3%.
Arrays 'b' reset
	Memory use is 15.3%.

=======================snip snip===============================
-- 
wierda@ltb.bso.nl (Gerben Wierda) || I speak for myself and not for my employer.
(+31) 2154 84415/(+31) 35 833539  || Support the League for Programming Freedom!
	"If you don't know where you are going, any road will take you there."
	(Almost from) Lewis Carroll, "Alice in Wonderland".
From: aas@rosmer.nr.no (Gisle Aas)
Newsgroups: comp.lang.perl
Subject: Re: randomize.c
Date: 31 Aug 92 12:36:20 GMT
Reply-To: Gisle.Aas@nr.no
Organization: Norwegian Computing Centre, Oslo, Norway

In article <Bts28y.DJA@rahul.net> dhesi@rahul.net (Rahul Dhesi) writes:

>   >The following short C program reads in lines from stdin, randomizes
>   >their order, and then writes out the newly ordered lines to stdout.
>
>   I couldn't resist rewriting it in perl.
>   
>   [lots of lines deleted]

Why not:    perl -e '@l=<>;print splice(@l,rand($#l),1) while @l'
--
Gisle Aas               |  snail: Boks 114 Blindern, N-0314 Oslo, Norway
Norsk Regnesentral      |  X.400: G=Gisle;S=Aas;O=nr;P=uninett;C=no
voice: +47-2-453561     |  inet:  Gisle.Aas@nr.no
Newsgroups: comp.lang.perl