[13930] 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:48:13 1999

Date: Tue, 9 Nov 1999 09:05:19 -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: <942167118-v9-i1326@ruby.oce.orst.edu>
Content-Type: text

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

Today's topics:
    Re: Alternative to <*> (Kragen Sitaker)
    Re: Batch Program Execution <vn8@sfsws1.de.lucent.com>
    Re: Batch Program Execution (Kragen Sitaker)
        call Java from Perl... <anna@cs.strath.ac.uk>
    Re: call Java from Perl... (Abigail)
    Re: Click the banner, get the click counted, and go to  (Michel Dalle)
    Re: copyleft notice? (David Cantrell)
    Re: copyleft notice? (Kragen Sitaker)
    Re: Debugging CGI under NT... (Matthew Miller)
    Re: Dynamic Configuration File rmore1@my-deja.com
        Execute a file in perl? (Ian)
    Re: Execute a file in perl? <gellyfish@gellyfish.com>
    Re: Execute a file in perl? <moseley@best.com>
    Re: FAQ 4.67: How can I use a reference as a hash key?  (Kragen Sitaker)
    Re: FAQ 8.31: Can I use perl to run a telnet or ftp ses (Kragen Sitaker)
        file permissions <dbohl@americas.sgi.com>
    Re: file permissions <gellyfish@gellyfish.com>
    Re: file permissions (Abigail)
    Re: file permissions <slanning@bu.edu>
    Re: How do U parse from the end of the line? <lr@hpl.hp.com>
    Re: how to make perl executable (Arved Sandstrom)
    Re: It is always like this here? (Malcolm Ray)
        list (array) programming question <heinrich@bucknell.edu>
    Re: list (array) programming question <kevinc@millfilm.co.uk>
    Re: list (array) programming question (Kragen Sitaker)
    Re: Looking for Perl cgi that can handle 'accounts'...h <gellyfish@gellyfish.com>
        mapping .cgi to .pl jobmail@my-deja.com
    Re: mapping .cgi to .pl (Jon Bell)
    Re: mapping .cgi to .pl <gellyfish@gellyfish.com>
    Re: MP3.pm - play/control your mpeg music via perl (Chris Nandor)
        Multiple cookies question with CGI.pm? <shmooth@yahoo.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 09 Nov 1999 16:02:16 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Alternative to <*>
Message-Id: <cAXV3.60639$23.2337609@typ11.nn.bcandid.com>

In article <YkOV3.368$RV5.9338@nsw.nnrp.telstra.net>,
Martien Verbruggen <mgjv@comdyn.com.au> wrote:
>The perldelta for 5.004 says:
>     No glob() or <*>
>          These operators may spawn the C shell (csh), which
>          cannot be made safe.  This restriction will be lifted
>          in a future version of Perl when globbing is
>          implemented without the use of an external program.
>
>The perldelta for 5.005 does not mention this anymore. This very
>likely means that 5.005+ does not use the shell anymore (someone
>correct me if I'm wrong). That may just be what could solve your
>problem. Get them to install perl 5.005_03.

5.005_03 spawns sh which spawns csh to glob <*>.
-- 
<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 09:10:33 +0100
From: Vijay N Rao <vn8@sfsws1.de.lucent.com>
Subject: Re: Batch Program Execution
Message-Id: <3827D6F9.F7B275D5@sfsws1.de.lucent.com>

Thanks David.
Yeh considering your suggestion, I have this question. I need to continously do
FTP from a PC to a host. Is this possible using perl?
regards
vijay

David Cassell wrote:
> 
> Vijay N Rao wrote:
> >
> > Hello,
> >
> > I need to execute a batch file in a perl script. How can this be done?
> 
> You will want to look up Perl's system() command, as well as
> qx// .  You can find these using the perldoc program at your
> command prompt:
> 
> perldoc -f system
> perldoc perlop  [then search for qx]
> 
> Then consider whether Perl has the functionality to do what you
> wanted without your needing to take the time to shell out to
> your OS and run that batch file.
> 
> David
> --
> David Cassell, OAO                     cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician


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

Date: Tue, 09 Nov 1999 16:32:09 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Batch Program Execution
Message-Id: <d0YV3.60904$23.2341168@typ11.nn.bcandid.com>

In article <3827D6F9.F7B275D5@sfsws1.de.lucent.com>,
Vijay N Rao  <vn8@sfsws1.de.lucent.com> wrote:
>Yeh considering your suggestion, I have this question. I need to continously do
>FTP from a PC to a host. Is this possible using perl?

Yes.
-- 
<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 14:15:14 +0000
From: Anna Stavrianou <anna@cs.strath.ac.uk>
Subject: call Java from Perl...
Message-Id: <38282C72.F32A2B04@cs.strath.ac.uk>

Hello. I am totally inexperienced in Perl...
I am working on a solaris system and I want to execute a java class from a CGI
script.

I wrote this:

system "/usr/local/java1.2/bin/java    /home/s/anna/Hello_client";

where Hello_client is a "Hello_client.class" file.

I have a server already running but ...nothing is returned - not even an error.
I've tried with exec as well but ... nothing.

Can anybody help me? How can I execute a java class from Perl and see something?

thank you,
anna



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

Date: 9 Nov 1999 10:19:00 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: call Java from Perl...
Message-Id: <slrn82giic.6es.abigail@alexandra.delanet.com>

Anna Stavrianou (anna@cs.strath.ac.uk) wrote on MMCCLXI September
MCMXCIII in <URL:news:38282C72.F32A2B04@cs.strath.ac.uk>:
&& Hello. I am totally inexperienced in Perl...
&& I am working on a solaris system and I want to execute a java class from a CGI
&& script.
&& 
&& I wrote this:
&& 
&& system "/usr/local/java1.2/bin/java    /home/s/anna/Hello_client";
&& 
&& where Hello_client is a "Hello_client.class" file.
&& 
&& I have a server already running but ...nothing is returned - not even an error.

How would you know? You're not checking the return value of system.

&& I've tried with exec as well but ... nothing.
&& 
&& Can anybody help me? How can I execute a java class from Perl and see something?


There are various ways, depending on what you mean by "see something".

man perlipc.


Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


  -----------== 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 10:54:55 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Click the banner, get the click counted, and go to destination (CGI)?
Message-Id: <808us3$rno$2@news.mch.sbs.de>

In article <3827be19.216385406@news.supernews.com>, heron@hell.com (Kendar) wrote:
>I need to be able to do the following:
>
>When the user clicks into a banner, he/she activates a perl/cgi
>program which registers the click for that banner and sends the
>user to the supposed destination. Does anyone know of such a cgi
>program?

Yes. But since you're only looking for a script, and not trying to build 
one yourself, this is the wrong newsgroup to handle this...

Have you tried asking in comp.infosystems.www.authoring.cgi ?
Or had a look at the CGI Resource Index or other script
repositories on the web ? They have 55 of these things at
http://cgi.resourceindex.com/Programs_and_Scripts/Perl/Advertisements/

Goodbye,

Michel.


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

Date: Tue, 09 Nov 1999 10:12:34 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: copyleft notice?
Message-Id: <3828f2fc.403170869@10.0.0.155>

On Tue, 09 Nov 1999 03:34:35 GMT, "Donald \"Don\" Learner"
<d.learner@gte.net> said:

>I have come across a reference in a database textbook about Perl being "the
>only software product on the market to have a copyleft notice." What does
>this mean?

It means that:
  a) it is available under the GNU General Public License (also known
     as 'copyleft'; it is also available under the Artistic License)
  b) the book is full of shit cos they seem to have forgotten about
     such software products as gcc and countless others.

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: Tue, 09 Nov 1999 16:19:54 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: copyleft notice?
Message-Id: <KQXV3.60805$23.2340152@typ11.nn.bcandid.com>

In article <fDMV3.1411$Vg6.32253@dfiatx1-snr1.gtei.net>,
Donald \"Don\" Learner <d.learner@gte.net> wrote:
>I have come across a reference in a database textbook about Perl being "the
>only software product on the market to have a copyleft notice." What does
>this mean? 

This means your database textbook was written by someone who is grossly
ignorant about free software, and also ignorant about Perl's licensing,
since Perl can be licensed under either the copyleft or the Artistic
License.  (Yes, they are both puns.)

See http://www.gnu.org/copyleft/copyleft.html.
-- 
<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: 9 Nov 1999 15:48:30 GMT
From: namille2@news.vt.edu (Matthew Miller)
Subject: Re: Debugging CGI under NT...
Message-Id: <809foe$kaa$1@solaris.cc.vt.edu>

On 9 Nov 1999 04:56:11 GMT, Eric Bohlman <ebohlman@netcom.com> wrote:
>
>Use Ctrl-z to indicate EOF.

Hey, thank you, thats it. Honestly I knew that but it's been so long since
I had to know it that I had forgotten it...
>
>Try running the script by "perl name_of_script" rather than just 
>"name_of_script."  NT's command processor has some rather peculiar ideas 
>about what command-line info to pass to a program invoked through file 
>associations.
>

Thanks I'll try that.

Matthew



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

Date: Tue, 09 Nov 1999 15:47:15 GMT
From: rmore1@my-deja.com
Subject: Re: Dynamic Configuration File
Message-Id: <809fm3$1mm$1@nnrp1.deja.com>

In article <Pine.GSO.4.10.9911051313050.29670-
100000@user2.teleport.com>,
  Tom Phoenix <rootbeer@redcat.com> wrote:
> On Fri, 5 Nov 1999 rmore1@my-deja.com wrote:
>
> > I was wondering what is the best method for accessing a
configuration
> > file ...
>
> Define "best". What's best for me may not be best for you, and
there's no
> point in any of us wasting our time until you can say just what you
want.
>
> You may need to choose among fastest, most memory efficient, easiest
to
> program, fewest lines of code, most robust, most portable, easiest to
> debug, easiest to maintain, most like your other favorite programming
> languages, or perhaps you mean some other criterion. (Of course, one
> solution may fall into more than one of these categories.)
>
> Cheers!
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
>
>

--
=============================
Richard More
http://www.richmore.com/


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


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

Date: Tue, 09 Nov 1999 14:30:47 GMT
From: Ian@no.co.uk (Ian)
Subject: Execute a file in perl?
Message-Id: <38282fca.18514030@news.tesco.net>

What is the best method
to execute another file in perl?

Ian


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

Date: 9 Nov 1999 14:41:43 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Execute a file in perl?
Message-Id: <382832a7_1@newsread3.dircon.co.uk>

Ian <Ian@no.co.uk> wrote:
> What is the best method
> to execute another file in perl?
> 

see system() in the perlfunc manpage ...

/J\
-- 
"Like Anne Robinson in a Korean restaurant, it'll be dog eat dog" -
Graham Norton


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

Date: Tue, 9 Nov 1999 06:54:23 -0800
From: Bill Moseley <moseley@best.com>
Subject: Re: Execute a file in perl?
Message-Id: <MPG.1291d57b80c9abca989860@nntp1.ba.best.com>

Ian (Ian@no.co.uk) seems to say...
> What is the best method
> to execute another file in perl?

kill() - executes other running programs
die()  - not really an execution, more of a suicide
exit() - when you know your time is over
unlink() - this will do it in.

It's a morbid language.


-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: Tue, 09 Nov 1999 16:28:05 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: FAQ 4.67: How can I use a reference as a hash key?  
Message-Id: <pYXV3.60894$23.2339952@typ11.nn.bcandid.com>

In article <38279f7e@cs.colorado.edu>,
Tom Christiansen  <perlfaq-suggestions@perl.com> wrote:
>  How can I use a reference as a hash key?
>
>    You can't do this directly, but you could use the standard
>    Tie::Refhash module distributed with perl.

#!/usr/bin/perl -w
my ($a, $b);
my ($x, $y) = \($a, $b);
@z{$x, $y} = qw(bibi baba);
print map { "$_ => $z{$_}\n" } \($a, $b);

This appears to work fine.  What do you mean, you can't do it?  The
references get stringified, don't they?
-- 
<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 16:17:05 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: FAQ 8.31: Can I use perl to run a telnet or ftp session?
Message-Id: <5OXV3.60771$23.2339764@typ11.nn.bcandid.com>

In article <8083t0$34d$1@nnrp1.deja.com>,  <steven_ellis@my-deja.com> wrote:
>In article <381d02d8@cs.colorado.edu>,
>  perlfaq-suggestions@perl.com (Tom and Gnat) wrote:
>>         if (fork()) {               # XXX: undef means failure
>>             select($handle);
>>             print while <STDIN>;    # everything from stdin to socket
>>         } else {
>>             print while <$handle>;  # everything from socket to stdout
>>         }
>>         close $handle;
>
>One problem with this code is that the socket closes before all the
>incoming data has been streamed through.

Funny, it shouldn't.


-- 
<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 09:35:10 -0600
From: Dale Bohl <dbohl@americas.sgi.com>
Subject: file permissions
Message-Id: <38283F2E.A24C54E0@americas.sgi.com>


   Can anyone tell me how to do the following?

I want to get the permissions of a file with
the stat command.  I think this is right.

($mode)=(stat($filename))[2];

How do I convert $mode to a format
usable by chmod?


-- 

Thanks,
Dale

Dale Bohl
SGI Information Services
Engineering Building
1050 Lowater Road
Chippewa Falls, WI 54729-1445
dbohl@sgi.com
(715)-726-8406


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

Date: 9 Nov 1999 16:12:00 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: file permissions
Message-Id: <382847d0_1@newsread3.dircon.co.uk>

Dale Bohl <dbohl@americas.sgi.com> wrote:
> 
> I want to get the permissions of a file with
> the stat command.  I think this is right.
> 
> ($mode)=(stat($filename))[2];
> 
> How do I convert $mode to a format
> usable by chmod?
> 

see eg

<http://www.deja.com/getdoc.xp?AN=542488464&fmt=text>


/J\
-- 
"He is marvelous at beating men and achieving real penetration" -
Alex Ferguson


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

Date: 9 Nov 1999 10:45:08 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: file permissions
Message-Id: <slrn82gk3e.6es.abigail@alexandra.delanet.com>

Dale Bohl (dbohl@americas.sgi.com) wrote on MMCCLXI September MCMXCIII in
<URL:news:38283F2E.A24C54E0@americas.sgi.com>:
** 
**    Can anyone tell me how to do the following?
** 
** I want to get the permissions of a file with
** the stat command.  I think this is right.
** 
** ($mode)=(stat($filename))[2];
** 
** How do I convert $mode to a format
** usable by chmod?


Not only is this discussed in the manual, a similar question was
asked and answered a few hours ago.



Abigail
-- 
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
          for (s;s;s;s;s;s;s;s;s;s;s;s)
              {s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'


  -----------== 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: 09 Nov 1999 11:58:03 -0500
From: Scott Lanning <slanning@bu.edu>
Subject: Re: file permissions
Message-Id: <kusemdzob50.fsf@bottom.bu.edu>

Dale Bohl <dbohl@americas.sgi.com> writes:
> ($mode)=(stat($filename))[2];
> 
> How do I convert $mode to a format
> usable by chmod?

What format--or radix--is it in now, and what format does
chmod want? (see my post answering this same question last night)

-- 
"I'm going to have fun telling you about this absurdity, because I
find it delightful." --Richard Feynman


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

Date: Tue, 9 Nov 1999 00:01:32 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How do U parse from the end of the line?
Message-Id: <MPG.129174b27cb79c0a98a1c5@nntp.hpl.hp.com>

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.

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

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

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


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

Date: Tue, 09 Nov 1999 07:04:57 -0400
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: how to make perl executable
Message-Id: <Arved_37-0911990704570001@dyip-16.chebucto.ns.ca>

In article <806k9l$57j$1@news3.global-ip.net>, "michael hagberg"
<mzh@cntw.com> wrote:

> I would like my programs that I write in perl to work on my friends
> computers too. As they are not nerds they dont want to install perl. So tell
> me Abigail, how do you show your stuff for your friends??? Now you know
> *why*.
> 
One of the consequences of using interpreted code is that you have to have
the interpreter. Not only Perl but also Java (and a bunch of other
languages) require the interpreter to be there.

Typically, on various OS's, folks usually come up with bundling solutions,
wrapping a Perl interpreter in with the script. Someone told you about
perl2exe on Windows; MacOS has RuntimeBuilder. But these are actually
gaining you nothing.

Perl installation (with MacPerl on MacOS, and ActiveState on Windows) is
about as painless as it gets. If your friends can't double-click (which is
all it takes for these installs), then they really have problems. :-) And
on your end you can make life a bit easier for them by preparing DOS .bat
files to run your scripts with the proper arguments.

Trying not to be snarky, and possibly failing... :-)

HTH, Arved


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

Date: 9 Nov 1999 11:23:50 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: It is always like this here?
Message-Id: <slrn82g126.7fa.M.Ray@carlova.ulcc.ac.uk>

On 08 Nov 1999 11:00:28 -0700, Eric The Read <emschwar@rmi.net> wrote:
>But presence of quantity does not mean high quality.  The argument of
>high quality cannot be based on volume.
>
>All I was saying was that Perl has an Imperial buttload of documentation, 

It's been a *metric* buttload since 5.005_03.  Upgrade!

>but you can't claim that it's any good, simply by virtue of there being a 
>lot of it.  Likewise, you can't claim it's any bad, by the same virtue.
>In fact, you couldn't even claim it was bad if there were only one page
>(a la Perl4) of documentation-- inadequate, perhaps, but not necessarily
>bad.

I see a lot of people making (mainly reasonable) criticisms of the docs,
but I don't see any volunteers.
-- 
Malcolm Ray                           University of London Computer Centre


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

Date: Tue, 09 Nov 1999 09:46:23 -0500
From: Paul Heinrich <heinrich@bucknell.edu>
Subject: list (array) programming question
Message-Id: <382833BF.DBBBC626@bucknell.edu>


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.

thank you,  Paul





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

Date: 09 Nov 1999 15:51:33 +0000
From: Kevin Campbell <kevinc@millfilm.co.uk>
Subject: Re: list (array) programming question
Message-Id: <szu2mviry2.fsf@vic.millfilm.co.uk>


the following works for me, but is not especially efficient:

#!/usr/bin/perl5 -w

my @mylist=qw/one two three four/;
my @comb=combinations(@mylist);
foreach(@comb){
  print join(' ',@$_),"\n";
}

sub combinations{
  my @result=([]);
  my @list=@_;

  foreach my $item (@list){
    @result=map {[@$_],[@$_,$item]} @result;
  }
  shift @result; #get rid of the empty entry
  return @result;
}

kevin
-- 
Kevin Campbell  
kevinc@millfilm.co.uk           +44-171-287-4041 ext. 306       
Mill Film, 40-41 Great Marlborough St, London, W1V 1DA UK  



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

Date: Tue, 09 Nov 1999 16:42:48 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: list (array) programming question
Message-Id: <caYV3.60916$23.2342621@typ11.nn.bcandid.com>

In article <382833BF.DBBBC626@bucknell.edu>,
Paul Heinrich  <heinrich@bucknell.edu> 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.

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

>I
>need to be able to have the perl script create a superset of all

I think you mean a 'set'.

>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

Keep in mind that there will be 2^n possibilities for a list of n.
-- 
<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: 9 Nov 1999 09:32:09 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Looking for Perl cgi that can handle 'accounts'...hard 2 find...why?
Message-Id: <3827ea19_2@newsread3.dircon.co.uk>

Kragen Sitaker <kragen@dnaco.net> wrote:
> In article <807ebf$j7h$1@nnrp1.deja.com>, Jeff Boes  <jboes@qtm.net> wrote:
>>> I've been looking around the web in various Perl resources and
>>depositories of
>>
>>Have you looked at http://www.cgi-resources.com/?
> 
> 
> In brief, I don't recommend looking at www.cgi-resources.com unless you
> are experienced enough to not need it.
> 

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)

/J\
-- 
"How much fun can a girl have with a rabbit?" - Channel 4 Continuity
Announcer


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

Date: Tue, 09 Nov 1999 16:20:34 GMT
From: jobmail@my-deja.com
Subject: mapping .cgi to .pl
Message-Id: <809hkc$3gi$1@nnrp1.deja.com>

I am trying to run perl scripts on Infradig web server on win95.  When
I run scripts with .pl they work fine.   When I change the extentions
from .pl to .cgi I get an error message -- 'doc. contains no data'.
Can anyone help me to map .cgi extention to .pl ?   Thanks.


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


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

Date: Tue, 9 Nov 1999 16:38:04 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: mapping .cgi to .pl
Message-Id: <FKxvJG.96z@presby.edu>

  <jobmail@my-deja.com> wrote:
>I am trying to run perl scripts on Infradig web server on win95.  When
>I run scripts with .pl they work fine.   When I change the extentions
>from .pl to .cgi I get an error message -- 'doc. contains no data'.
>Can anyone help me to map .cgi extention to .pl ?   Thanks.

This sounds like a server configuration issue to me.  The experts on
Windows-based servers are in comp.infosystems.www.servers.ms-windows.

-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA
        [     Information about newsgroups for beginners:     ]            
        [ http://www.geocities.com/ResearchTriangle/Lab/6882/ ]


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

Date: 9 Nov 1999 16:45:18 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: mapping .cgi to .pl
Message-Id: <38284f9e_1@newsread3.dircon.co.uk>

jobmail@my-deja.com wrote:
> I am trying to run perl scripts on Infradig web server on win95.  When
> I run scripts with .pl they work fine.   When I change the extentions
> from .pl to .cgi I get an error message -- 'doc. contains no data'.
> Can anyone help me to map .cgi extention to .pl ?   Thanks.
> 

I'm sure those nice people in comp.infosystems.www.servers.ms-windows can.

/J\
-- 
"How much fun can a girl have with a rabbit?" - Channel 4 Continuity
Announcer


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

Date: Tue, 09 Nov 1999 13:22:27 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: MP3.pm - play/control your mpeg music via perl
Message-Id: <pudge-0911990822300001@192.168.0.77>

In article <MPG.128ca94145032f098984a@nntp1.ba.best.com>, Bill Moseley
<moseley@best.com> 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)

The first individual posted the same thing twice to two different groups.  Sigh.

Anyway, as I said in clp.modules, the Xmms module is also a solution, and
he should consider writing his own module.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Tue, 09 Nov 1999 16:52:17 GMT
From: Shmooth <shmooth@yahoo.com>
Subject: Multiple cookies question with CGI.pm?
Message-Id: <382851FF.E21477A4@yahoo.com>

I've been using the function-oriented call of CGI.pm to send multiple
cookies back to the browser/client, but it seems to chop the 1st cookie
and only sends the second.  This remains true whichever order I put the
cookies in.  I've verified they're definitely there.  I've tried
alternate syntaxes but nothing seems to go.  I don't really understand
the CGI.pm/Cookie.pm code, else I'd try to troubleshoot it myself.  Any
ideas on what I could be doing wrong?  Maybe I *have* to use the object
interface??  I'm on Win32 (more build info at bottom).

#Here's my call - only $cookie2 gets spit out
# I've also tried using multiple '-cookie' headers, '-set_cookie'
headers, etc.
print header(-cookie=>[$cookie1,$cookie2]);

Thanks. (build info below)

-------------------------------------------------------------------
This is perl, version 5.005_03 built for MSWin32-x86-object
(with 1 registered patch, see perl -V for more detail)

Binary build 518 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 13:14:00 Jun 24 1999
-------------------------------------------------------------------




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

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 1326
**************************************


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