HDTenEightyP/NetNews huggingface dataset:
From: watson@carssdf.UUCP (- Self Empl. Sys.Integrator)
Newsgroups: comp.lang.perl
Subject: fail test using SCO 3.2.4 Devl Sys
Keywords: t/lib/big.t
Date: 6 Apr 92 20:10:08 GMT
Organization: John Watson (Self Employed System Integrator)

I have recompiled perl on SCO 3.2.4 and have a few problems with memory
exceptions.  I recompiled with -Od (and others for that matter), and found
that one of the tests is failing.  Test #62 of lib/big.t is the first test
that uses the form     local (*x, *y),
If the line is changed to local ($x, $y) then the test passes, but I'm sure
this is only by-passing the benefit of the test, as then other tests fail
for the same reason.

  Does anyone know what is going on here?

  Does anyone know what -O??? work best with SCO 3.2.4 ?

Thanks, John Watson
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: Checking amount of physical memory with Perl ?
Date: 10 Apr 92 01:41:37 GMT
Organization: NetLabs, Inc.

In article <bshaw.702318096@bobasun> bshaw@bobasun.hc.ti.com (Bob Shaw) writes:
: 
: I was asked this question ...
: 
: Is there a way in perl to check how much
: physical memory is installed on your system.  
: I recall seeing something on the net awhile back on using 
: adb to do this.  I would also be interested in this info as well.

This is highly machine dependent.  With that in mind, under SunOS on
a Sparc you can say

    $_ = `adb -k /vmunix /dev/mem </dev/null 2>&1`;
    if (/physmem\s+(.*)/) {
	print "Physical memory is ", int(hex($1) / 256 + 1), " megs\n";
    }
    else {
	die $_;
    }

On a Sun3 you'd want to divide by 128 instead, I believe.

The other way is to run ps and compare RSS with %MEM.  You have to fudge
it for the part of memory it doesn't think is available to you.

Larry
From: me@anywhere.EBay.Sun.COM (Wayne Thompson)
Newsgroups: comp.lang.perl
Subject: Proposal: Interactive Perl Tutorial
Date: 5 Apr 92 16:10:49 GMT
Organization: Sun Microsystems, Inc.
NNTP-Posting-Host: anywhere.ebay.sun.com

Quite a while back I decided to write an interactive perl tutorial.
But my job kept getting in the way ;-). Since I still have a job,
I'm proposing that we spec. out such a beast and farm out the modules.
I have developed a framework toward that end that might serve. It's
a hypertext subsystem written for curseperl. Any thoughts? Any takers?

Wayne
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: question
Originator: tchrist@pixel.convex.com
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: CONVEX Realtime Development, Colorado Springs, CO
Distribution: comp.lang.perl
Date: Thu, 16 Apr 1992 17:11:35 GMT
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 robt@is.morgan.com (Rob Torop):
:Can someone explain this to me?  I want to write function which opens
:a pipe to fsql and then sends it some commands.  This was easy enough, but
:I can't figure out how to add error handling, at least to make sure
:that sybase is up.  Here's the kind of thing I'm doing:
:
:    sub fsql {
:       local(@commands) = @_;
:
:       open(FSQL, "| fsql");
:       print FSQL join(";\n", @commands) . ";\n";
:       close(FSQL);
:       return 1;
:    }
:
:I'd like to be able to know that the open suceeded. I've tried things like
:
:    eval <<'abracadabra';
:    open("| fsql") || die;
:abracadabra
:
:    # look at $@, @$, ...
:
:but they don't work.  What's the hip way to do it?  Thanks.

My hipness meter doesn't peg this one too well, but you can
always do something like this:

    if (($pid = open(FQSL, "| fqsl")) && kill(0, $pid)) {
	# stuff
	close(FQSL) || return 0;
    } else {
	return 0;
    } 
    return 1;

--tom
From: henkp@cs.ruu.nl (Henk Penning)
Newsgroups: comp.lang.perl
Subject: Re: novice q: finding unique words in a list
Keywords: help,unique
Date: 7 Apr 92 22:25:04 GMT
Organization: Utrecht University, Dept. of Computer Science

In <1992Apr2.212950.20613@u.washington.edu> czar@hardy.u.washington.edu (Nathan Clement) writes:

>i just started working in PERL, so hopefully this is a trivial question
>kind souls could answer quickly.  i'm trying to create a list of all the
>unique words in an array; cf. unique() in S, or sort -u in UNIX.  
>
>czar@silvae.cfr.washington.edu

  Next to grep and sort, uniq should be a Perl primitive.

				===  HenkP  ===
Newsgroups: comp.lang.perl
From: mcook@mrc.dev.cdx.mot.com (Michael Cook)
Subject: Re: Simplifying (optimising) regular expressions
Organization: Motorola Codex, Canton, Massachusetts
Date: Sun, 5 Apr 1992 15:08:17 GMT

garyb@abekrd.co.uk (Gary Bartlett) writes:

>Does anyone have any standard methods (perhaps similar to De Morgan's rules)
>for simplifying (perl) regular expressions?

John Hopcroft and Jeffrey Ullman may be able to help you.  See their
book _Introduction to Automata Theory, Languages, and Computation_,
1979, Addison-Wesley.

They explain how to convert a RE to a Nondeterministic Finite
Automaton, how to convert that NFA into a Deterministic FA, and then
how to minimize the FA.  They'll even show you how to convert that DFA
back into a RE.  It's all very "mechanizable".  But I wouldn't say
that it's trivial.

Anyhow, if you can't get the answer you want there, maybe some of the
references can help you.
-- 
 Michael Cook                   Motorola/Codex
 (617)821-7590                  20 Cabot Blvd, C2-135
 mcook@merlin.dev.cdx.mot.com   Mansfield, MA 02048
From: drw@nevanlinna.mit.edu (Dale R. Worley)
Newsgroups: comp.lang.perl
Subject: Re: looking for a C parser
Date: 8 Apr 92 22:26:20 GMT
Organization: MIT Dept. of Tetrapilotomy, Cambridge, MA, USA

In article <mcook.702688464@mrc.dev.cdx.mot.com> mcook@mrc.dev.cdx.mot.com (Michael Cook) writes:
   Does anyone have a Perl program that can parse ANSI C source?  

No.

Parsing ANSI C exactly correctly is a real bitch.  To do it correctly,
you will almomst certainly have to buy a commercial parser.

Dale Worley		Dept. of Math., MIT		drw@math.mit.edu
--
Of course, the best way to defend an indefensible position is to announce
loudly that it should be above attack.	-- greg@phoenix.princeton.edu
From: SXC101@psuvm.psu.edu
Newsgroups: comp.lang.perl
Subject: passing assoc. arrays to sub-routines
Date: 14 Apr 92 01:39:49 GMT
Organization: Penn State University

I would like to pass Assoc. arrays by value to subroutines..

&sub_routine(%a,%b,%c);

sub sub_routine {

local(%x,%y,%z) = @_;
 ..
..
}

When I pass more than one assoc. array, the values are not proper..
any suggestions?

chakra
From: jhd@irfu.se (Jan D.)
Newsgroups: comp.lang.perl
Subject: Re: beginners question: why does my pipe not work?
Date: 16 Apr 92 10:33:39 GMT
Organization: Swedish Institute of Space Physics, Uppsala, Sweden

In article <1992Apr15.133208.24121@chx400.switch.ch> klarenbe@chx400.switch.ch (Paul Klarenberg) writes:
>Hi Hackers,
>
>I followed earlier discussions on pipes. So I tried the FAQ 20 example.
>Didn't work. So stripped it down to:
>
>$| = 1;                       # force flush after each read/write
>pipe(RH, WH) || die "shit\n"; # creating pipe\n";
>print(WH "w\n");              # write something to pipe
>$line = <RH>;                 # read it from the other end
>print "$line";                # print stuff that went through pipe
>
>The program hangs on $line = <RH>. To my understanding a UNIX pipe
>allows simultanious writing on one side, and reading from the other. A
>similar script that closes the write side after writing, and then
>reads, works ok. But this is of course not what I need. Could you
>explain what I do wrong/misunderstand?

Perl uses stdio for read and write which by default is buffered.
That's why closing the write side before reading works, it flushes
the buffer before closing.

What you need to do is tell perl to not use buffering on WH:
$| = 1;                       # force flush after each read/write
pipe(RH, WH) || die "shit\n"; # creating pipe\n";
$old = select(WH);	      # make WH the currently selected filehandle
$| = 1;			      # Make WH unbuffered.
select($old);		      # restore previous selected filehandle.
print(WH "w\n");              # write something to pipe
$line = <RH>;                 # read it from the other end
print "$line";                # print stuff that went through pipe


>
>Thanks a lot!
>

You're welcome.

BTW, when was the FAQ last posted? It has dissapeared from my site.

	Jan D.
Newsgroups: comp.lang.perl
From: mab@wdl39.wdl.loral.com (Mark A Biggar)
Subject: Re: split with quoted strings
Organization: Loral Western Development Labs
Date: Tue, 14 Apr 1992 15:52:27 GMT

In article <1992Apr13.231643.26109@merlin.dev.cdx.mot.com> lezz@merlin.dev.cdx.mot.com (Lezz Giles) writes:
>I want to split a string into elements, where the initial string may contain
>quoted strings, e.g.
>
>   &split(`this "is an" awkward "string"`) ->
>               ("this", "is an", "awkward", "string")

The following should do it:

sub split {
	local($_) = @_;
	local(@tmp) = ();
	while (length $_) {
		s/^\s*//;
		s/^"([^\\"]*(\\.[^\\"]*)*)"// && do {
			push(@tmp, $1);
			next;
		};
		s/^\S+// && do {
			push(@tmp, $&);
			next;
		};
	}
}

It even allows for \\ and \" in the "" strings.

--
Perl's Maternal Uncle
MArk Biggar
mab@wdl1.wdl.loral.com



Newsgroups: comp.lang.perl
From: drw@kronecker.mit.edu (Dale R. Worley)
Subject: Forms-oriented input system
Organization: MIT Dept. of Tetrapilotomy, Cambridge, MA, USA
Date: Tue, 14 Apr 1992 16:53:13 GMT

I've written a forms-oriented input system in Perl.  It works pretty
well, at least for what I need it for.  I thought people might like to
try it out, so the next two messages are the code and documentation
for it.  Beware that this system needs curseperl, and you have to
comment out the calls to getcap unless you install the patch to
curseperl I've posted previously.  (This is explained toward the
bottom of the documentation.)

Dale Worley		Dept. of Math., MIT		drw@math.mit.edu
--
Go ahead, make my night!	-- lapel button
Newsgroups: comp.lang.perl
From: narayan@aravali.everest.tandem.com (Pankaj Narayan)
Subject: Is PERL better than AWK ?
Reply-To: narayan@aravali.everest.tandem.com (Pankaj Narayan)
Organization: Tandem Computers Inc., Cupertino CA
Date: Mon, 6 Apr 1992 21:51:04 GMT

This may be a FAQ, so please mail me the answer.

Else, tell me, specifically, in what way is PERL better than AWK ?
What are the features that it has that aren't there in AWK ? 

BTW, does AWK have associative arrays ? 
-- 
------------------------------------------------------------------------
Pankaj Narayan			Email: narayan_pankaj@tandem.com
Tandem Computers			Voice: 408 285 6047 (work)  
19333 Vallco Pkwy, Loc 3-06		Voice: 408 737 8632 (home)
Cupertino, CA 95014-2599		Fax:   408 285 7079
Newsgroups: comp.lang.perl
From: mcook@mrc.dev.cdx.mot.com (Michael Cook)
Subject: looking for a C parser
Organization: Motorola Codex, Canton, Massachusetts
Date: Tue, 7 Apr 1992 23:14:24 GMT

Does anyone have a Perl program that can parse ANSI C source?  In
particular, I'm interested in being able to determine where symbols
are defined, and where where they are used.
-- 
 ==========================================================
 Michael.Cook@merlin.dev.cdx.mot.com          (617)821-7590
 Motorola/Codex, 20 Cabot Blvd, C2-135, Mansfield, MA 02048
 ==========================================================
Newsgroups: comp.lang.perl
From: ccechk@nuscc.nus.sg (Heng Kek)
Subject: Help: searching, translating chars.
Organization: National University of Singapore
Date: Fri, 10 Apr 1992 03:37:19 GMT

Hello,
	Here are 2 questions from a novice Perlite:

- Question 1:
What is the quickest code to translate a given string to one
which has a capitalised first letter?  (the 'string' is actually
a word.)  For e.g. 'january' or 'JANUARY' or 'jANuarY' or
'JaNUaRy' should translate to 'January'.

- Question 2:
When doing a pattern search, is it quicker to match a shorter
pattern than a long one?  For e.g. if a searched line is:
"the rain in Spain falls mainly on the plain" 
will '/nly/' match faster than '/falls mainly on the/'?

Kek
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: How do you use stderr in perl?
Originator: tchrist@pixel.convex.com
Keywords: stderr, fileno, file descriptor
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: CONVEX Realtime Development, Colorado Springs, CO
Date: Fri, 17 Apr 1992 18:42:07 GMT
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 potter@watson.ibm.com (David Potter):
:I am not a perl programmer, but i have some perl scripts that I 
:maintain. Recently I added some output to a c program that is 
:written to stderr (fd 2).  One place where this program is used
:is a ksh script, and redirecting that output is easy -- 2>....
:
:In the perl script where that program is used it is not so easy. 
:The line of perl that opens the pipe running my program looks like this:
:
:open (AFILE, "/path/cmd -a <$input 2>/dev/null |") || die "msg"
:
:The problem is apparrently that fd 2 is not stderr. On page 145 of
:the camel book, there is a caution that you can not rely on fd's 0, 1 and 2
:being stdin, stdout and stderr. So i tried STDERR in place of 2. 
:That did not work -- would not compile.  So i tried $stderr=fileno(STDERR).
:That did not compile either.  There must be a reiable why to use 
:stderr, Can some one point me to the right section of the camel book? 

std{in,out,err} should only change from {0,1,2} if you were
opening, closing, and reopening them with wild abandon.

Doing this:

    $stderr=fileno(STDERR);
    open (AFILE, "/path/cmd -a <$input $stderr>/dev/null |") || die "msg"

probably won't help you, becuase /path/cmd is sure to think 
that stderr is in fd 2.

BTW, that die will only be taken if the fork fails; if /path/cmd
fails, you won't know it.

--tom
From: ado@bigcomm.gun.de (Christoph Adomeit)
Newsgroups: comp.lang.perl
Subject: Re: Perl for commercial software?
Date: 11 Apr 92 01:44:14 GMT
Article-I.D.: bigcomm.1992Apr11.014414.1090
Organization: adosoft

bernd@euler.iss.nus.sg (Bernd Nordhausen) writes:


>By now we all now what a great language perl is. However, I would like to 
>hear whether people are using Perl to write commercial software.

>I am in contact with a software company to do some development work for them.
>When I suggested to use Perl they were extremely reluctant. As a commerical
>company, they do not want to give out any source code or scripts.

>So I would like to hear whether any commercial software has been developed in
>Perl, and in what form it has been distributed.

I implemented some Informix-SQL Support and Screen Handling routines in Perl
and sell those scripts. I give away scripts in an encrypted form and added
support for decription in Perl. I don't know in the moment, how I did it,
because i have the sources in my company, but it was very easy. As far as I
know, I had only have a pointer pointing to my own decryption function and
that was it. I used some public-domain en/decryption program.

I you are interested, I will look, how I did it and post an example.
Newsgroups: comp.lang.perl
From: Marc Horowitz <marc@mit.edu>
Subject: Re: Syntax of delete
Reply-To: Marc Horowitz <marc@mit.edu>
Organization: The Internet
Date: Mon, 13 Apr 1992 04:57:57 GMT

|> Either way you answer, perl is inconsistent.

Yes, perl is inconsistent.  Yes, perl has weird shit.  Yes, perl is
difficult to read, and hard to write optimally.

We know.

Stop pointing it out at every opportunity.  You're not proving
anything besides your ability to be obnoxious.

		Marc
Xref: sparky comp.lang.perl:3146 comp.sys.hp:5205
From: brown@cs.utk.edu (Lance A. Brown)
Newsgroups: comp.lang.perl,comp.sys.hp
Subject: Re: Problem compiling perl on hp9000/730 running hp-ux 8.05
Date: 14 Apr 92 14:39:16 GMT
	<1992Apr12.165927.25478@fmsrl7.srl.ford.com>
	<BROWN.92Apr12225158@duncan.cs.utk.edu>
	<1992Apr14.072912.13440@irfu.se>
Organization: Univ of TN, Knoxville - CS Department
NNTP-Posting-Host: galoob.cs.utk.edu
In-reply-to: jhd@irfu.se's message of 14 Apr 92 07:29:12 GMT

In article <1992Apr14.072912.13440@irfu.se>, jhd@irfu.se (Jan D.) writes:

> 8.07 malloc is OK, but test's I made show that perl's malloc is faster
> (between 30 and 100 %) when it comes to allocating a lot of (small) blocks
> in different sizes. The HP malloc is more space effective though.
> Depends on what you wan't really, space or speed.

> However, there hasn't been a perl (since 3.0 at least) that hasn't worked
> with perl malloc. There has been trouble with HP malloc from time to time.

I must have been doing something wrong than, because the perl 4.019 binary
I got by compiling WITH Perl's malloc seg faults immediately when it is
run.  This is on a HP 9000/720 under HP-UX 8.07.  Time to play around with
the configuration again. :-(

Lance
--
Lance A. Brown  <brown@cs.utk.edu>
  The Crystal Wind is the Storm, and the Storm is Data,
     and the Data is Life -- The Player's Litany
                                 from _The Long Run_ by D.K. Moran
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: Writing and reading from /tmp files -PIPES ?
Originator: tchrist@pixel.convex.com
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: CONVEX Realtime Development, Colorado Springs, CO
Date: Fri, 10 Apr 1992 00:19:05 GMT
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 narayan@aravali.everest.tandem.com (Pankaj Narayan):
:If I want to do this in  one script:
:   read input line by line
:  for each line, process it and write a line to a /tmp file
:
:  in second  pass , read line by line from the /tmp file and
:  process it, and write  to the final (result) file.
:
: I would like to get rid of the /tmp file altogether. Seems to be a place
:that I could use pipes. But the problem is that I am piping back data to
:code in the same script. How would I do it ?

Open a pipe to a child process, perhaps like this:

    die "can't fork: $!" unless defined ($pid = open(CHILD, "|-"));

and then write to CHILD, and she'll read it from STDIN.

An (overly elborate) example follows.

--tom


#!/usr/local/bin/perl
#
# checknews -- pipe to words for formatting.
# by Tom Christiansen <tchrist@convex.com>

&getwin;

#$ARGV[0] eq '-c' && ($chopit++, shift);
$chopit++;

$WIDTH = ($cols > 80) ? 20: 13;

die "can't fork: $!" unless defined ($pid = open(WORDS, "|-"));
if ($pid) {
    select(WORDS);
    open(RN, "rn -t -s750 -c @ARGV|");
    @newsgroups = <RN>;
    $chopit = 0  if @newsgroups < 5;
    for (@newsgroups) {
	next unless ($_, $count) = /^(\S+): (\d+)/;
	0 while $chopit && $WIDTH < length && s/\b(\w)[^.]+\./$1./;
	$_ = sprintf("%3d %s\n", $count, $_);
	s/ +$//;
	print;
    }
    close WORDS;
    wait;
    exit $?;
} 


##################################################################
# from here on in is my basic "words" script...  included here
# so that checknews is self-contained.  some versions of pr
# are smart enough to do this.  sadly, ours is not one of them.

sub eol { ($elt+1) % $cols == 0; }	# is this the last elt on line?

$maxlen = 1;	# widest string yet seen



while (<STDIN>) { 	# read stdin into $_
    s/\s+$//;
    $maxlen = $mylen if (($mylen = length($_)) > $maxlen);
    push(list, $_);
} 

$maxlen += 1;  # spaces

$cols = int($cols / $maxlen);
$rows = int(($#list+$cols) / $cols);
$mask = sprintf("%%-%ds ", $maxlen);

for ($elt = 0; $elt < $rows * $cols; $elt++) { 
    $target =  ($elt%$cols) * $rows + int(($elt/$cols));
    $piece = sprintf($mask, $target < ($#list+1) ? $list[$target] : "");
    $piece =~ s/\s+$// if do eol();  # don't blank pad to eol of line
    print $piece;
    print "\n" if do eol();
}

print "\n" if do eol();

exit 0;

sub getwin {
    $TIOCGWINSZ = 0x40087468;  # should be require sys/ioctl.ph
    if (ioctl(STDOUT, $TIOCGWINSZ, $winsize)) {
	($rows, $cols, $xpixel, $ypixel) = unpack('S4', $winsize);
    } else {
	$cols = 80;
    }
}
From: peter@micromuse.co.uk (Peter Galbavy)
Newsgroups: comp.lang.perl
Subject: Re: Perl for commercial software?
Date: 9 Apr 92 10:41:27 GMT
Organization: MicroMuse Limited, London, England.

In article <1992Apr7.081146.21107@nuscc.nus.sg>,
bernd@euler.iss.nus.sg (Bernd Nordhausen) writes:
> I am in contact with a software company to do some development work
> for them.
> When I suggested to use Perl they were extremely reluctant. As a
> commerical
> company, they do not want to give out any source code or scripts.
> 
> So I would like to hear whether any commercial software has been
> developed in
> Perl, and in what form it has been distributed.
> 
> Or is that people use perl only to develop prototypes that are then
> recoded
> in C or some other compiled language?

One product I know that uses perl is SUNnet Manager - although the
version included is 3.0.44 or similar, and I do not *yet* know enough
about the package to tell you how extensively it is used... full
report at 11.

-- 
Peter Galbavy
Tech Support, Micromuse Ltd
Phone: +44 71 352 7774		E-Mail: P.Galbavy@micromuse.co.uk

Hi! I'm a new generation of the .signature virus. Copy me to join in
the fun!
Newsgroups: comp.lang.perl
Subject: Using rsh in perl
From: fsb@sparc.vitro.com (Steve Brailsford)
Date: 7 Apr 92 12:18:57 GMT
Distribution: world
Keywords: perl rsh


I have been learning perl, and have been playing with a
program that reads the df report on several machines
and gives me a report on them.  To get the df I set the
$system var to the machine I want, and then do a

        $ret = `rsh $system df`;

Is this the only way to do it, or are there better ways?
If I don't have rsh access to a machine this doesn't work.
I do not want to put logins, with passwords in a script either.
Maybe I should check for nothing in $ret, and then go to
something that prompts me for a loginname and password?

--
    Steve Brailsford (fsb@sparc.vitro.com)   _____
    Usenet:  uupsi!vitro!sparc!fsb         \/itro Corporation
    Voice:  (301) 231-1481                  14000 Georgia Ave.
    Fax:    (301) 231-2020                  Silver Spring, MD 20906
Newsgroups: comp.lang.perl
From: millert@kinglear.cs.colorado.edu (Todd C. Miller)
Subject: texinfo version of perl man page?
Organization: University of Colorado at Boulder
Date: Wed, 8 Apr 1992 05:11:44 GMT

Quite some time ago someone posted that they had done a texinfo version of the
perl man page, can anyone give me a pointer as to hwere i can ftp it from?

 - todd
-- 
Todd C. Miller                    | "But all the politiCIAns now
millert@cs.Colorado.EDU           |  They have no excuse
al804@cleveland.Freenet.Edu       |  They just hide behind their power
University of Colorado @ Boulder  |  And keep us from the truth" - Roger McGuinn
From: krab@iesd.auc.dk (Kresten Krab Thorup)
Newsgroups: comp.lang.perl
Subject: Re: novice q:  finding unique words in a list
Date: 5 Apr 92 18:03:02 GMT
Organization: Mathematics and Computer Science, Aalborg University

>i just started working in PERL, so hopefully this is a trivial question
>kind souls could answer quickly.  i'm trying to create a list of all the
>unique words in an array; cf. unique() in S, or sort -u in UNIX.  

Try something like:

sub uniq {
	local(%tmp);
	grep($tmp{$_}++,@_);
	keys(%tmp);
}

You may, if you like, wrap a sort around the last line, to make the
result sorted.

/Kresten
--
What you can't do idaw, maybe you can do imorn'
Newsgroups: comp.lang.perl