[13899] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

No subject found in mail header

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 10 17:44:58 1999

Date: Tue, 9 Nov 1999 15:10:31 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942189031-v9-i1329@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 9 Nov 1999     Volume: 9 Number: 1329

Today's topics:
        garbage collection <balance08@bow.intnet.mu>
    Re: garbage collection <sariq@texas.net>
    Re: garbage collection (Matthew Bafford)
    Re: garbage collection (Abigail)
    Re: garbage collection <gellyfish@gellyfish.com>
    Re: garbage collection (Kragen Sitaker)
    Re: garbage collection <jll@skynet.be>
        How do I turn on NUM-LOCK on NT system? <eric_farr@hotmail.com>
    Re: How do I turn on NUM-LOCK on NT system? <gellyfish@gellyfish.com>
    Re: How do U parse from the end of the line? (Robert Dennis Manchester)
        how to parse dir recursively for files? mirranda@my-deja.com
    Re: How to use stat function ? <aqumsieh@matrox.com>
        I don't want to wait the child ? (Ryan Ngi)
    Re: I don't want to wait the child ? <emschwar@rmi.net>
        language differences and extensions <balance08@bow.intnet.mu>
    Re: language differences and extensions (Matthew Bafford)
        Language specifications <balance08@bow.intnet.mu>
    Re: Language specifications <dan@tuatha.sidhe.org>
    Re: Language specifications (Matthew Bafford)
    Re: Language specifications (Kragen Sitaker)
    Re: list (array) programming question (Thank you) <heinrich@bucknell.edu>
    Re: list (array) programming question <earlw@kodak.com>
    Re: list (array) programming question (Tad McClellan)
    Re: list (array) programming question <lr@hpl.hp.com>
    Re: list (array) programming question (Abigail)
    Re: list (array) programming question <cassell@mail.cor.epa.gov>
    Re: list (array) programming question <cassell@mail.cor.epa.gov>
    Re: Looking for Perl cgi that can handle 'accounts'...h (Kragen Sitaker)
    Re: MP3.pm - play/control your mpeg music via perl <murat.uenalan@sietec.de>
        New Perl and CGI Resource site info@perlscan.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 9 Nov 1999 18:45:48 GMT
From: "Jean-Patrick Madelon" <balance08@bow.intnet.mu>
Subject: garbage collection
Message-Id: <01bf2a16$e4d562a0$330eead4@pat>

What kind of garbage collection and automatic resource does it have if any?
How does that interfere with features of real-time response, persistence,
transactions and finalizations?


Jean-Patrick.



------------------------------

Date: Tue, 09 Nov 1999 13:46:34 -0600
From: Tom Briles <sariq@texas.net>
Subject: Re: garbage collection
Message-Id: <38287A1A.B4B67EF6@texas.net>

Jean-Patrick Madelon wrote:
> 
> What kind of garbage collection and automatic resource does it have if any?

Well, I've been programming in Perl for years now, and I *still* have to
manually put my garbage out on the curb every Monday morning. 
Sometimes, I'll do it Sunday night so that I won't forget.

> How does that interfere with features of real-time response, persistence,
> transactions and finalizations?

Well, I can't react to anything else in real-time if I'm taking out the
garbage.

HTH.  HAND.

- Tom


------------------------------

Date: Tue, 09 Nov 1999 21:00:06 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: garbage collection
Message-Id: <slrn82h2gv.2r0.*@dragons.duesouth.net>

And so it happened, on 9 Nov 1999 18:45:48 GMT, Jean-Patrick Madelon"
<balance08@bow.intnet.mu> typed random characters into perl, and ended
up with the following posted to comp.lang.perl.misc: 
: What kind of garbage collection and automatic resource does it have if any?
: How does that interfere with features of real-time response, persistence,
: transactions and finalizations?

That depends on how you are coding.

Perhaps you should read the manual pages for Perl.

man perl

We are here to help, but you are expected to read before you post.  Most
of the messages you have posted are fully answered in the manual.
 
: Jean-Patrick.

--Matthew


------------------------------

Date: 9 Nov 1999 15:21:41 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: garbage collection
Message-Id: <slrn82h49u.6es.abigail@alexandra.delanet.com>

Jean-Patrick Madelon (balance08@bow.intnet.mu) wrote on MMCCLXI September
MCMXCIII in <URL:news:01bf2a16$e4d562a0$330eead4@pat>:
\\ What kind of garbage collection and automatic resource does it have if any?
\\ How does that interfere with features of real-time response, persistence,
\\ transactions and finalizations?


Could you stop posting questions and start reading the manual?



Abigail
-- 
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print 
               qq{Just Another Perl Hacker\n}}}}}}}}}'    |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: 9 Nov 1999 21:13:13 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: garbage collection
Message-Id: <80a2pa$h8t$1@gellyfish.btinternet.com>

On 9 Nov 1999 18:35:45 GMT Jean-Patrick Madelon wrote:
> What kind of language specifications are available?
> Are they formal?
> Are there some standard?

On 9 Nov 1999 18:37:36 GMT Jean-Patrick Madelon wrote:
> What kind of language differences and extensions does Perl support or not
> support?

On 9 Nov 1999 18:40:12 GMT Jean-Patrick Madelon wrote:
> Does Perl have lexical scoping?
> Does it support call by name or call by value?
> Are there parallel constructs?

On 9 Nov 1999 18:42:38 GMT Jean-Patrick Madelon wrote:
> Is Perl fully reflective?

On 9 Nov 1999 18:43:15 GMT Jean-Patrick Madelon wrote:
> Is Perl multi threaded?

On 9 Nov 1999 18:45:48 GMT Jean-Patrick Madelon wrote:
> What kind of garbage collection and automatic resource does it have if any?
> How does that interfere with features of real-time response, persistence,
> transactions and finalizations?

I get a little worried when I see questions like this - it appears that
you are coming with some preconceptions that you want to fit Perl against -
I think that you might be better off if you start by reading the documentation
for Perl - wherein you will find the answers almost straight away to 
some of your questions but you will also find that some of your questions
dont even make sense when applied to Perl.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Tue, 09 Nov 1999 22:07:13 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: garbage collection
Message-Id: <lW0W3.61758$23.2380828@typ11.nn.bcandid.com>

In article <01bf2a16$e4d562a0$330eead4@pat>,
Jean-Patrick Madelon <balance08@bow.intnet.mu> wrote:
>What kind of garbage collection and automatic resource does it have if any?

Reference-counting without a backup garbage collector (except that
surviving objects are finalized in arbitrary order at program
termination).

>How does that interfere with features of real-time response, persistence,
>transactions and finalizations?

I don't know that Perl can offer real-time guarantees; a number of its
most useful fundamental operations (insertion into a hash, matching
against a regex) take unpredictable amounts of time.  Perl doesn't have
built-in support for persistence or transactions, so I don't know how
gc would interact with them.  Finalizations (DESTROY methods) are
carried out immediately upon zero refcount, and I imagine people write
programs which depend on this, which is unfortunate.  Surviving objects
get finalized at program termination.  I don't know about finalizations
of resuscitated objects.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: 09 Nov 1999 23:46:23 +0100
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: garbage collection
Message-Id: <m3ogd3z3k0.fsf@enterprise.newedgeconcept>


"Jean-Patrick Madelon" <balance08@bow.intnet.mu> writes:

> What kind of garbage collection and automatic resource does it have if any?
> How does that interfere with features of real-time response, persistence,
> transactions and finalizations?

What I'm going to say may not gain consensus but...

Perl doesn't have garbage collection. It has automatic memory
management all right, in the form of built-in reference counting.

This is not GC because either:

1) garbage is never produced, entities are reclaimed as soon as they
   are no longer reachable

2) if you've created cyclic structures, garbage there can be, but Perl
   will not collect it for you

Thus no GC.

Regarding persistence: yes persistence layers can't help being dragged
into memory management issues. Perl is *almost* an ideal platform for
implementing orthogonal persistence properly. What's missing are weak
references :-(

For passing mentions of persistence vs MM see the Tangram website
(www.tangram-persistence.org) and browse the p5p archives.

-- 

 V
VLR		Jean-Louis Leroy
 F		http://users.skynet.be/jll





------------------------------

Date: Tue, 09 Nov 1999 19:45:46 GMT
From: "Eric Farr" <eric_farr@hotmail.com>
Subject: How do I turn on NUM-LOCK on NT system?
Message-Id: <KR_V3.7551$Ur4.125482@news.rdc1.tn.home.com>

Can someone show me how I would force the number-lock on in Perl code on an
NT system?

Thanks,
Eric




------------------------------

Date: 9 Nov 1999 21:15:11 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How do I turn on NUM-LOCK on NT system?
Message-Id: <80a2sv$h90$1@gellyfish.btinternet.com>

On Tue, 09 Nov 1999 19:45:46 GMT Eric Farr wrote:
> Can someone show me how I would force the number-lock on in Perl code on an
> NT system?
> 

print "PRESS THE Num Lock KEY NOW !!\n";

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 9 Nov 1999 17:32:06 GMT
From: rmanches@cs.brown.edu (Robert Dennis Manchester)
Subject: Re: How do U parse from the end of the line?
Message-Id: <809lqm$e75@cocoa.brown.edu>

On Tue, 9 Nov 1999 00:01:32 -0800, Larry Rosler <lr@hpl.hp.com> wrote:
:In article <slrn82f106.1u.chesta@lester.manchero.org> on 9 Nov 1999 
:02:17:07 GMT, Rob Manchester <chesta@brown.edu> says...
:
:...
:
:> @name = ("some","path","txt");
:> where
:> print @name[0]  -> some
:> print @name[1]  -> path
:> print @name[2]  -> txt
:
:These scalars are better written as such, rather than as array slices.  
:'-w' would warn about this.

Yes, that was a typo, very poor explination.
$name[] was what I ment. Though I noticed in my 
sample program I had both @ & $, not a very consistent explination, thanks
for catching it.


:> if we just
:> print @name that is the value or the array, which is three,
:
:No it isn't.  In list context (as for 'print()') it is all the elements 
:in the array.

wow, looks like rob needs to do a man perlarrays, or put some thought
into which languange he is explaining.

:> print @name[@name-1] -> txt
:> print @name[@name]  -> error
:> we can 
:> my $basename = "@name[@name-2].@name[@name-1]";
:> which gives us "path.txt"
:
:Just '-1' will do where you have '@name - 1', etc.

I was not aware of that.  That is a nice feature.

-rob


------------------------------

Date: Tue, 09 Nov 1999 22:04:10 GMT
From: mirranda@my-deja.com
Subject: how to parse dir recursively for files?
Message-Id: <80a5on$jfe$1@nnrp1.deja.com>

guys,
I need to get every file in every directory uner "my directory" that has
".abc" extension and store it into an array.

This is how far i got.  But I just get the directory names and not the
files.

@ARGV = qw(.) unless @ARGV;
use File::Find ();
sub find(&@) {&File::Find::find}
*name = *File::Find::name;
find { print $name if -d } @ARGV;

Thanks,
Mirranda


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Tue, 9 Nov 1999 13:15:24 -0500 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to use stat function ?
Message-Id: <x3yyac7r0oz.fsf@tigre.matrox.com>


Adrian Chin <Achin@inprise.com> writes:

> I am confused on how stat () actually works.

Did you read what the docs say about stat()?

> I have :
> 
>     $mode = (stat $file) [2];
> 
> it prints out :
> 
> mode = 16893 for a directory which is drwxrwxr-x
> mode = 33261 for a file which is -rwxr-xr-x
> 
> How come 9 and 8 existed in the mode result ?

From 'perldoc -f stat':

<QUOTE>
Because the mode contains both the file type and its permissions, you
should mask off the file type portion and (s)printf using a C<"%o"> 
if you want to see the real permissions.
 
    $mode = (stat($filename))[2];
    printf "Permissions are %04o\n", $mode & 07777;
</QUOTE>

--Ala



------------------------------

Date: Tue, 09 Nov 1999 19:04:19 GMT
From: ryanngi@hotmail.com (Ryan Ngi)
Subject: I don't want to wait the child ?
Message-Id: <38286c2b.20128206@news.inet.co.th>

Hi guys,

	my problem is::

	when people request my cgi via their browser,
the cgi do many jobs and taking a very long time to send the last
output "SUCCESS"..... 

	so i try to fork some part of the program which take very long
time.... and hope to send "SUCCESS" immediately after the user request
and doing the very long time job behind.............. but it's not
wok! ...i can't make the child process out of the parent, the parent
still wait the child..

	this is the code::

=======================

if($pid = fork){
        print "Content-type: text/html\n\n";
        print "SUCCESS";

}
else{
	#doing a very long time job may be
	sleep 20;
};

=======================


what should i insert to the code to make it work as my though  ?

or ....must i use other ways rather than fork???




------------------------------

Date: 09 Nov 1999 13:15:41 -0700
From: Eric The Read <emschwar@rmi.net>
Subject: Re: I don't want to wait the child ?
Message-Id: <xkfogd3bevm.fsf@valdemar.col.hp.com>

ryanngi@hotmail.com (Ryan Ngi) writes:
> 	when people request my cgi via their browser,
> the cgi do many jobs and taking a very long time to send the last
> output "SUCCESS"..... 

This just SCREAMS comp.infosystems.www.authoring.cgi.  9 times out of 10, 
if your post contains the initialism "CGI", then that's where you should
ask it.  And probably then, anyway, because they'll refer you here, if
it's not appropriate there.

> 	so i try to fork some part of the program which take very long
> time.... and hope to send "SUCCESS" immediately after the user request
> and doing the very long time job behind

There's at least one issue you may not have considered, namely that the
very long process might not succeed.  Is it a good idea to send SUCCESS
before you know whether or not it's succeeded?

>.............. but it's not wok! ...i can't make the child process out
> of the parent, the parent still wait the child..

The issue here is most likely that you didn't close all the open
filehandles in your child process, but I can't say for sure.  Try closing 
all open filehandles (even the ones you didn't open yourself, like STDIN
and so forth) and see if that does it.  But ask this question on ciwa.cgi
for a more complete answer.

-=Eric
-- 
"Cutting the space budget really restores my faith in humanity.  It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation."
                -- Johnny Hart


------------------------------

Date: 9 Nov 1999 18:37:36 GMT
From: "Jean-Patrick Madelon" <balance08@bow.intnet.mu>
Subject: language differences and extensions
Message-Id: <01bf2a15$bfd43ae0$330eead4@pat>

What kind of language differences and extensions does Perl support or not
support?

Jean-Patrick


------------------------------

Date: Tue, 09 Nov 1999 21:03:32 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: language differences and extensions
Message-Id: <slrn82h2tk.2r0.*@dragons.duesouth.net>

On 9 Nov 1999 18:37:36 GMT, Jean-Patrick Madelon"
<balance08@bow.intnet.mu> was attempting to recharge the laptop battery
by typing: 
: What kind of language differences and extensions does Perl support or not
: support?

Perl is a very different language, but it has extended to use constructs
from a variety of other languages.

perl is also very extendable in other ways, which are outlined in its
documentation.
 
Perhaps you should read the manual pages for Perl.

man perl

We are here to help, but you are expected to read before you post.  Most
of the messages you have posted are fully answered in the manual.

: Jean-Patrick

--Matthew


------------------------------

Date: 9 Nov 1999 18:35:45 GMT
From: "Jean-Patrick Madelon" <balance08@bow.intnet.mu>
Subject: Language specifications
Message-Id: <01bf2a15$7dbbc240$330eead4@pat>

What kind of language specifications are available?
Are they formal?
Are there some standard?



Jean-Patrick


------------------------------

Date: Tue, 09 Nov 1999 20:21:58 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Language specifications
Message-Id: <Gn%V3.2643$c06.22924@news.rdc1.ct.home.com>

Jean-Patrick Madelon <balance08@bow.intnet.mu> wrote:
> What kind of language specifications are available?
> Are they formal?
> Are there some standard?

Given how many single questions you've posted, perhaps we should ask:

Are you asking us to do your homework instead of just reading the perl
docs?

					Dan


------------------------------

Date: Tue, 09 Nov 1999 21:00:10 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Language specifications
Message-Id: <slrn82h2pr.2r0.*@dragons.duesouth.net>

On 9 Nov 1999 18:35:45 GMT, Jean-Patrick Madelon"
<balance08@bow.intnet.mu> poured coffee onto a keyboard, producing the
following in comp.lang.perl.misc: 
: What kind of language specifications are available?

The Perl manual pages seem to have a lot of information about Perl.

: Are they formal?

That depends on what you mean on formal.

: Are there some standard?

This is answered in the Perl FAQ.

Perhaps you should read the manual pages for Perl.

man perl

We are here to help, but you are expected to read before you post.  Most
of the messages you have posted are fully answered in the manual.

: Jean-Patrick

--Matthew


------------------------------

Date: Tue, 09 Nov 1999 21:52:26 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Language specifications
Message-Id: <uI0W3.61746$23.2379409@typ11.nn.bcandid.com>

In article <01bf2a15$7dbbc240$330eead4@pat>,
Jean-Patrick Madelon <balance08@bow.intnet.mu> wrote:
>What kind of language specifications are available?

Only the manual.

>Are they formal?

It's pretty complete, but it's not as formal as an ANSI standard.  And
there are some things that are unspecified in the manual.

>Are there some standard?

Only the manual and implementation.

There are, to some extent, multiple implementations, though.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: Tue, 09 Nov 1999 13:02:23 -0500
From: Paul Heinrich <heinrich@bucknell.edu>
Subject: Re: list (array) programming question (Thank you)
Message-Id: <382861AF.3C14B46A@bucknell.edu>

> To everyone who answered my question,

   Thank you for your help.  Kevin Campbell posted a program which I was
able to
adapt to my problem.

thanks again,  Paul




------------------------------

Date: Tue, 09 Nov 1999 12:06:11 -0500
From: Earl Westerlund <earlw@kodak.com>
Subject: Re: list (array) programming question
Message-Id: <38285483.253@kodak.com>

Paul Heinrich wrote:
> 
> Hello,
> 
> I'm working on a perl script which writes SAS programs.  I have a
> statistical problem which requires running an analysis on a very large
> number of possible models.  Rather than try to write the model statments
> 
> by hand, I thought that this might be a good use of perl (though I am
> not a perl programmer).  Getting a perl script to write n copies of a
> SAS program to a text file was easy, but I am stuck on a key point.  I
> need to be able to have the perl script create a superset of all
> possible unique combinations of elements of a list.  For example, if I
> have a list including the three elements 'one', 'two', and 'three'.  I'd
> 
> like the program to return the following:
> 
> one
> one two
> one three
> one two three
> two
> two three
> three
> 
> I've looked through the CPAN archives for something similar, but had no
> luck.  Could someone point me to a module which does this or suggest a
> possible tact for solving this problem?  I think that someone interested
> 
> in word puzzels might have already written something like this.

Wouldn't it be easier to stay in SAS and use macros?
-- 
+-----------------+----------------------------------------+
| Earl Westerlund | Kodak's Homepage: http://www.kodak.com |
+-----------------+----------------------------------------+
|  The opinions expressed herein are mine and mine alone   |
|     (most people don't seem to want them anyway)         |
+----------------------------------------------------------+


------------------------------

Date: Tue, 9 Nov 1999 07:54:37 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: list (array) programming question
Message-Id: <slrn82g6cd.ogm.tadmc@magna.metronet.com>

On Tue, 09 Nov 1999 09:46:23 -0500, Paul Heinrich <heinrich@bucknell.edu> wrote:

>I
>need to be able to have the perl script create a superset of all
                                                              ^^^
>possible unique combinations of elements of a list.  For example, if I
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>have a list including the three elements 'one', 'two', and 'three'.  I'd
>
>like the program to return the following:
>
>one
>one two
>one three
>one two three
>two
>two three
>three

But that is not "all possible unique combinations".

It is missing

two one

for instance...


>I've looked through the CPAN archives for something similar, but had no
>luck.  Could someone point me to a module which does this or suggest a
>possible tact for solving this problem?  I think that someone interested
>
>in word puzzels might have already written something like this.


   Someone interested in providing the answers to Questions that
   are Asked Frequently might have already written something 
   like this  :-)


   Perl FAQ, part 4:

      "How do I permute N elements of a list?"


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: Tue, 9 Nov 1999 11:05:31 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: list (array) programming question
Message-Id: <MPG.12921052385cf45198a1c7@nntp.hpl.hp.com>

In article <slrn82g6cd.ogm.tadmc@magna.metronet.com> on Tue, 9 Nov 1999 
07:54:37 -0500, Tad McClellan <tadmc@metronet.com> says...
+ On Tue, 09 Nov 1999 09:46:23 -0500, Paul Heinrich 
<heinrich@bucknell.edu> wrote:
+ >I need to be able to have the perl script create a superset of all
+                                                               ^^^
+ >possible unique combinations of elements of a list.  For example, if
+  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ >I have a list including the three elements 'one', 'two', and 'three'.
+ >
+ >I'd like the program to return the following:
+ >
+ >one
+ >one two
+ >one three
+ >one two three
+ >two
+ >two three
+ >three
+ 
+ But that is not "all possible unique combinations".
+ 
+ It is missing
+ 
+ two one
+ 
+ for instance...

You are confusing 'permutations' with 'combinations'.  To quote from 
"Mastering Algorithms with Perl":  'A combination is just like a 
permutation except that we don't care about the ordering of the items.' 

+ >I've looked through the CPAN archives for something similar, but had
+ >no luck.  Could someone point me to a module which does this or
+ >suggest a possible tact for solving this problem?  I think that
+ >someone interested in word puzzels might have already written
+ >something like this.
+ 
+    Someone interested in providing the answers to Questions that
+    are Asked Frequently might have already written something 
+    like this  :-)
+ 
+    Perl FAQ, part 4:
+ 
+       "How do I permute N elements of a list?"

Which is totally irrelevant to the question asked, which is how to 
generate the 'power set' of a set -- the set of all combinations.

The book I referred to above doesn't have an algorithm to generate the 
power set, just to count the number of permutations and combinations.  
But someone else posted an algorithm here today.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 9 Nov 1999 13:38:21 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: list (array) programming question
Message-Id: <slrn82gu7p.6es.abigail@alexandra.delanet.com>

Tad McClellan (tadmc@metronet.com) wrote on MMCCLXI September MCMXCIII in
<URL:news:slrn82g6cd.ogm.tadmc@magna.metronet.com>:
`` On Tue, 09 Nov 1999 09:46:23 -0500, Paul Heinrich <heinrich@bucknell.edu> wrote:
`` 
`` >I
`` >need to be able to have the perl script create a superset of all
``                                                               ^^^
`` >possible unique combinations of elements of a list.  For example, if I
``  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`` >have a list including the three elements 'one', 'two', and 'three'.  I'd
`` >
`` >like the program to return the following:
`` >
`` >one
`` >one two
`` >one three
`` >one two three
`` >two
`` >two three
`` >three
`` 
`` But that is not "all possible unique combinations".
`` 
`` It is missing
`` 
`` two one

Since he's talking about sets, 'two one' is the same as 'one two'.
It looks like he just wants the superset of a set. 

    @set   = qw /one two three/;
    @power = ([]);

    map {my $e = $_; push @power => map {[@$_, $e]} @power} @set;


``    Perl FAQ, part 4:
`` 
``       "How do I permute N elements of a list?"


Permutations aren't the same as power sets.



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


------------------------------

Date: Tue, 09 Nov 1999 11:50:22 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
To: heinrich@bucknell.edu
Subject: Re: list (array) programming question
Message-Id: <38287AFE.E5AC9629@mail.cor.epa.gov>

[email cc sent also]

Paul Heinrich wrote:
> I'm working on a perl script which writes SAS programs.  I have a
> statistical problem which requires running an analysis on a very large
> number of possible models.  Rather than try to write the model statments
> by hand, I thought that this might be a good use of perl (though I am
> not a perl programmer).  Getting a perl script to write n copies of a
> SAS program to a text file was easy, but I am stuck on a key point.  I
> need to be able to have the perl script create a superset of all
> possible unique combinations of elements of a list.  For example, if I
> have a list including the three elements 'one', 'two', and 'three'.  I'd

Okay, so you want the 'power set' of you list.  You should do
the following, in order:
[1] Review the statistical problem and ascertain whether you
    *really* want to do such a thing.  It is unlikely you really
    need this.  I'm not kidding.  The stat analysis needs to
    be done properly.
[2] If you really need this, then first check whether SAS
    provides this feature within the proc(s) you're using.
    Some procs like PROC REG will do this for you, just by
    specifying the right options.
[3] If not, then check whether this would be easier to do
    as a SAS macro instead.
[4] Use the code already presented in this thread to get the
    power set [minus the zero case].

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Tue, 09 Nov 1999 11:52:54 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: list (array) programming question
Message-Id: <38287B96.EBD90E3E@mail.cor.epa.gov>

Kragen Sitaker wrote:
[snip]
> Let me get this straight: you want to do something N times in N
> different ways, and so your solution is to write a program containing N
> copies of the code to do it?  Doesn't SAS have loops and subroutines?
> Or do you just not know SAS?  (I don't.)

SAS has such features.  But he's likely to end up using the
SAS macro language to get there, and plenty of SAS coders don't
know much about SAS macros.
 
[snip]
> Keep in mind that there will be 2^n possibilities for a list of n.

2^n -1 , because the null case won't be a valid analysis model
for the poster.  [I already checked that using the PSI::ESP 
module.]

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


------------------------------

Date: Tue, 09 Nov 1999 20:22:48 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Looking for Perl cgi that can handle 'accounts'...hard 2 find...why?
Message-Id: <so%V3.61615$23.2368115@typ11.nn.bcandid.com>

In article <3827ea19_2@newsread3.dircon.co.uk>,
Jonathan Stowe  <gellyfish@gellyfish.com> wrote:
>I did quite like this though (for novelty rather than practical value ):
>
>  <http://www.informatik.uni-frankfurt.de/~fp/Tools/ProcCGIInput>
>
>(From a link at CGI-Resources)

I have actually written CGI scripts in sh myself.  It's pretty hard.
This is an impressive piece of work.  It sort of reminds me of entries
to the IOCCC.

Here's a brief run-down of what I would change in this script if I could:
- reads input with dd count=1, which is slow (but possibly the only
  reasonable way in sh)
- interpolates the following user-supplied variables into command-lines
  without quoting.  (This may be for portability; some brain-dead sh's
  don't handle quotes inside backquotes very well.)
	- $CONTENT_LENGTH -- into dd's arguments, which means you can
	  have it read your input from any file you like (or write it
	  to any file you like)
	- all kinds of things into echo's arguments, which is probably
	  fairly harmless.
- It's easier to use IFS than cut to split the urlencoded arg string
- It's easier to use tr than cut to replace the +'s with spaces
- he passes user input to dc, and dc provides a shell escape command --
  but it looks harmless, because he uses cut to restrict it to two
  characters.
- everything goes through echo multiple times, which may result in
  problems with backslash handling on SysV platforms and whitespace
  handling everywhere
- doing it in sh, forking and invoking external programs to do simple
  things, is going to be slow, no matter what.

Did I miss anything?
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: Tue, 09 Nov 1999 18:55:08 +0100
From: Murat Uenalan <murat.uenalan@sietec.de>
Subject: Re: MP3.pm - play/control your mpeg music via perl
Message-Id: <38285FFB.5DEBD0C2@sietec.de>

Thank you,

But unfortunately not a win32 version ?! Could someone help me ?


M. Uenalan


Bill Moseley wrote:

> Murat Uenalan (murat.uenalan@sietec.de) seems to say...
> > Hey you,
> >
> > i think this is something wich everyone would need. I always wanted to
> > control
> > my music via a perl program. This should be a suggestion for you to
> > write some-
> > thing like this.
>
> CPAN:
> I /MP3/
> Distribution    CNANDOR/MPEG-MP3Info-0.71.tar.gz
> Distribution    J/JR/JRED/MPEG-MP3Play-0.09.tar.gz
> Module          MPEG::MP3Info   (CNANDOR/MPEG-MP3Info-0.71.tar.gz)
> Module          MPEG::MP3Play   (J/JR/JRED/MPEG-MP3Play-0.09.tar.gz)
> Module          MyMP3Play       (J/JR/JRED/MPEG-MP3Play-0.09.tar.gz)
>
> --
> Bill Moseley mailto:moseley@best.com
> pls note the one line sig, not counting this one.



------------------------------

Date: 9 Nov 1999 17:51:40 GMT
From: info@perlscan.com
Subject: New Perl and CGI Resource site
Message-Id: <809mvc$sug$5@nntp4.atl.mindspring.net>


Hello all,

Just letting everyone know of a new resource at http://perlscan.com
This is a completely Perl and CGI Search engine that we will be devoting a ton of time to. Please list your scripts there and get some free traffic, sales, fame, etc.

Have a great day!





------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 1329
**************************************


home help back first fref pref prev next nref lref last post