[12350] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5950 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 10 14:07:18 1999

Date: Thu, 10 Jun 99 11:01:35 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 10 Jun 1999     Volume: 8 Number: 5950

Today's topics:
    Re: Intersection of SEVERAL ( eg. 5 -> ) lists (Malcolm Ray)
    Re: Intersection of SEVERAL ( eg. 5 -> ) lists <gellyfish@gellyfish.com>
    Re: Intersection of SEVERAL ( eg. 5 -> ) lists <anfi@bigfoot.com>
    Re: Intersection of SEVERAL ( eg. 5 -> ) lists (Thomas Weholt)
    Re: Intersection of SEVERAL ( eg. 5 -> ) lists (Larry Rosler)
    Re: Intersection of SEVERAL ( eg. 5 -> ) lists (Larry Rosler)
    Re: Intersection of SEVERAL ( eg. 5 -> ) lists (Malcolm Ray)
    Re: invoking a script (not in a subshell) (Mark-Jason Dominus)
    Re: matching function for array? <rootbeer@redcat.com>
    Re: MySQL Placeholders II <mthomas@ulysses.jprc.com>
    Re: Net::SMTP <rootbeer@redcat.com>
    Re: OLE reference <cassell@mail.cor.epa.gov>
    Re: Perl "constructors" <jdporter@min.net>
    Re: perl debugging in emacs (Ilya Zakharevich)
    Re: Perldoc and Perlfaq <garethr@cre.canon.co.uk>
    Re: Perldoc and Perlfaq (I R A Aggie)
    Re: Perldoc and Perlfaq <chmouel@mandrakesoft.com>
    Re: print command (<<) in perl CGI (Larry Rosler)
    Re: Problems sorting. I'm stupid and I'll die (M.J.T. Guy)
    Re: Regexpr for loop to handle e-address list dalehend@flash.net
    Re: Script times-out after x minutes <aqumsieh@matrox.com>
    Re: sendmail doesn't work (DarStec)
    Re: Separating array into alphabetical array of arrays <droby@copyright.com>
    Re: Separating array into alphabetical array of arrays <droby@copyright.com>
    Re: strange problem for multithread programming... <rootbeer@redcat.com>
    Re: Substitution with functions (Larry Rosler)
    Re: What's the "halting problem"? (M.J.T. Guy)
    Re: Where is sendmail on NT using Perl <cassell@mail.cor.epa.gov>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 10 Jun 1999 16:01:07 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: Intersection of SEVERAL ( eg. 5 -> ) lists
Message-Id: <slrn7lvoa3.e8s.M.Ray@carlova.ulcc.ac.uk>

On Wed, 09 Jun 1999 22:27:39 GMT, Thomas Weholt <u970130@studbo.hit.no> wrote:
>Hi,
>
>I am not making this into a flame-war or something, BUT I did say I
>wanted to create an intersection list from several others, not two,
>but three or more. The FAQ, the Perl cookbook etc. show how to create
>an intersection using two lists. I got at least 3, most often 10-11
>lists of items. The code doesn`t have to be "dynamic", for example the
>code can just be
>
>@1 = (1,43,543,75,);
>.
>.
>.
>@10 = (432,43,53,632);
>etc.
>
># code to make the intersection of the lists
>
>if (defined(@1)) 
>{
># compute a intersection list
>}
>
># do same with all the lists, @2, @3 etc.
>
>if (defined(@10))
>{
># compute a intersection list based on the list created before
>}
>
>@intersection = # the intersection of the lists above.
>
>
>My problem is that I don`t know how to build this so that the number
>of lists can vary.
>
>Is this clearer?
>
>Thanks for your help.

Here's one attempt.  This assumes you have an array, @lol, containing
references to the arrays in question.

#!/usr/bin/perl -w

use strict;

my @intersection;
my @array1 = qw(apple orange banana);
my @array2 = qw(red green blue orange apple);
my @array3 = qw(ibm compaq apple);
my @lol = \( @array1, @array2, @array3 );
my %count;

foreach my $array (@lol)
{
  foreach (@$array) { $count{$_}++ }
}

foreach (keys %count) {
  push(@intersection, $_) if $count{$_} == @lol;
}

-- 
Malcolm Ray                           University of London Computer Centre


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

Date: 10 Jun 1999 17:03:36 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Intersection of SEVERAL ( eg. 5 -> ) lists
Message-Id: <375fe1d8@newsread3.dircon.co.uk>

Thomas Weholt <u970130@studbo.hit.no> wrote:
> On 10 Jun 1999 07:30:48 -0700, merlyn@stonehenge.com (Randal L.
> Schwartz) wrote:
> 
>>>>>>> "Thomas" == Thomas Weholt <u970130@studbo.hit.no> writes:
>>
>>Thomas> Perhaps I didn`t make it clear that I need to compute the intersection
>>Thomas> of more than 4-5 lists, often 10-12. And this varies. 
>>
>>Perhaps you didn't make it clear why the solutions from the FAQ won't
>>work for you then.
>>
>>Thomas> It is part of a "complex" search-engine. 
>>
>>At some point, you should punt and use a real database then.
>>
>>Thomas> Thanks for trying though.
>>
>>Well, it wouldn't be "trying" if we could get enough info to actually
>>help you. :)
>>
> I am not making this into a flame-war or something, BUT I did say I
> wanted to create an intersection list from several others, not two,
> but three or more. The FAQ, the Perl cookbook etc. show how to create
> an intersection using two lists. I got at least 3, most often 10-11
> lists of items. The code doesn`t have to be "dynamic", for example the
> code can just be
> 

Sorry I fail to understand why you are unable to alter the code in perlfaq4
to use more than two arrays - it seems perfectly obvious how one would
go about it :

    foreach $element (@array1, @array2) { $count{$element}++ }

I dont see any problem there in adding any number of other arrays.

/J\
-- 
"If homo sapiens really were 'homo' sapiens is that why they're
extinct?" - Joey, Friends


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

Date: Thu, 10 Jun 1999 18:18:17 +0200
From: Andrzej Filip <anfi@bigfoot.com>
To: Thomas Weholt <u970130@studbo.hit.no>
Subject: Re: Intersection of SEVERAL ( eg. 5 -> ) lists
Message-Id: <375FE548.81CFECDF@bigfoot.com>

Thomas Weholt wrote:

> Perhaps I didn`t make it clear that I need to compute the intersection
> of more than 4-5 lists, often 10-12. And this varies.
>
> It is part of a "complex" search-engine.

#!/usr/bin/perl
use strict;

sub intersect {
 return () unless @_; # no arrays intersection is empty
 my ($count,$ar)=(0);
 my %ELEMS=();
 for $ar ( @_ ) {
  die "ARRAY expected\n" unless ref( $ar) eq "ARRAY";
  if( not $count++ ) {
   for (@$ar) { $ELEMS{$_}=1;}
  }else{
   my %elems=();
   for (@$ar) { $elems{$_}=1;}
   for (keys %ELEMS) {
    delete( $ELEMS{$_}) unless exists( $elems{$_});
   }
  }
  return () unless %ELEMS; # intersection already empty
 }
 keys %ELEMS;
}

my @A=(1,2,4);
my @B=(3,4,5);
my @C=(1,4,6);

print join(",",&intersect( \@A, \@B, \@C ));
print "\n";


--
Andrzej (Andrew) A. Filip
http://www.bigfoot.com/~anfi
E-mail: anfi@bigfoot.com
I NO LONGER USE anfi@polbox.com
Posting history (all addresses):
http://www.dejanews.com/profile.xp?author=Andrzej%20Filip&ST=PS




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

Date: Wed, 09 Jun 1999 23:24:56 GMT
From: u970130@studbo.hit.no (Thomas Weholt)
Subject: Re: Intersection of SEVERAL ( eg. 5 -> ) lists
Message-Id: <375ef77d.12604238@news1.c2i.net>

On Wed, 09 Jun 1999 20:26:23 GMT, u970130@studbo.hit.no (Thomas
Weholt) wrote:

>Hi,
>
>Perhaps I didn`t make it clear that I need to compute the intersection
>of more than 4-5 lists, often 10-12. And this varies. 
>
>It is part of a "complex" search-engine. 
>
>Thanks for trying though.

I`m going to try the code you gave me. Haven`t coded perl seriously
for more than a couple of days. 

Anyway, thanks for all your help.




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

Date: Thu, 10 Jun 1999 09:18:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Intersection of SEVERAL ( eg. 5 -> ) lists
Message-Id: <MPG.11c98519abe8d56e989bb0@nntp.hpl.hp.com>

In article <375FD1C7.33DB3DAE@bigfoot.com> on Thu, 10 Jun 1999 16:55:03 
+0200, Andrzej Filip <anfi@bigfoot.com> says...
> Thomas Weholt wrote:
> > Perhaps I didn`t make it clear that I need to compute the intersection
> > of more than 4-5 lists, often 10-12. And this varies.
> >
> > It is part of a "complex" search-engine.
> >
> > Thanks for trying though.
> 
> Keep the list sorted - it makes the task very easy.

Argggh!

Zero for three.  'Very easy' and very, very slow.

Argggh!

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


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

Date: Thu, 10 Jun 1999 09:55:10 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Intersection of SEVERAL ( eg. 5 -> ) lists
Message-Id: <MPG.11c98dc7c501d936989bb4@nntp.hpl.hp.com>

In article <375ee8c9.8840542@news1.c2i.net> on Wed, 09 Jun 1999 22:27:39 
GMT, Thomas Weholt <u970130@studbo.hit.no> says...
> I am not making this into a flame-war or something, BUT I did say I
> wanted to create an intersection list from several others, not two,
> but three or more. The FAQ, the Perl cookbook etc. show how to create
> an intersection using two lists. I got at least 3, most often 10-11
> lists of items. The code doesn`t have to be "dynamic", for example the
> code can just be
> 
> @1 = (1,43,543,75,);
> .
> .
> .
> @10 = (432,43,53,632);
> etc.

Those are not useful array names.

> @intersection = # the intersection of the lists above.
> 
> 
> My problem is that I don`t know how to build this so that the number
> of lists can vary.

One way to do it:

Make an array of references to the arrays you want, and then loop over 
it.

my @arrays = (\@array1, \@array2, ... \@arrayn);

for my $aref (@arrays) {
    # Do something with @$aref
}

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


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

Date: 10 Jun 1999 17:10:00 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: Intersection of SEVERAL ( eg. 5 -> ) lists
Message-Id: <slrn7lvsb8.epj.M.Ray@carlova.ulcc.ac.uk>

On 10 Jun 1999 16:01:07 GMT, Malcolm Ray <M.Ray@ulcc.ac.uk> wrote:
>#!/usr/bin/perl -w
>
>use strict;
>
>my @intersection;
>my @array1 = qw(apple orange banana);
>my @array2 = qw(red green blue orange apple);
>my @array3 = qw(ibm compaq apple);
>my @lol = \( @array1, @array2, @array3 );
>my %count;
>
>foreach my $array (@lol)
>{
>  foreach (@$array) { $count{$_}++ }
>}
>
>foreach (keys %count) {
>  push(@intersection, $_) if $count{$_} == @lol;
>}

I forgot to point out that, like the code in perlfaq4, this assumes that
each element is unique in a given array.
-- 
Malcolm Ray                           University of London Computer Centre


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

Date: Thu, 10 Jun 1999 16:02:10 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: invoking a script (not in a subshell)
Message-Id: <7jonh2$kh7$1@monet.op.net>

In article <7jmodr$eba$5@fcnews.fc.hp.com>, Andrew Allen <ada@fc.hp.com> wrote:
>Ain't gonna happen. Since your current shell isn't perl, you can't run
>perl in your current shell.

That's what I thought at first, but now I'm not so sure.  What if the
shell execs the perl program, without forking, and then the perl
program changes the environment variables and re-execs the shell,
again without forking?

Of course, you'd lose all your shell internal data, like history and
non-environment variables.  But if this were a script to be run at
shell startup time, it might work.  Or if you used the `rc' shell,
which doesn't have non-environment variables and which keeps the
history in a file.

I've never heard of anyone actually doing this.  I don't know whether
it's actually a bad idea, or whether it's one of those things that
people do all the time in the alternate universe where parasails were
invented in the 16th Century.


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

Date: Thu, 10 Jun 1999 10:14:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: matching function for array?
Message-Id: <Pine.GSO.4.02A.9906101014150.26349-100000@user2.teleport.com>

On Wed, 9 Jun 1999, OPENLINX wrote:

> is there any way to find out "red" is in the array X?

See section four of the FAQ. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 10 Jun 1999 12:32:57 -0400
From: Mark Thomas <mthomas@ulysses.jprc.com>
Subject: Re: MySQL Placeholders II
Message-Id: <wf1so80j9s6.fsf@ulysses.jprc.com>


[comp.lang.perl.modules dropped from Newsgroups:]

In <7jnreh$evu$1@taliesin.netcom.net.uk>, Clinton Gormley writes:
    > $list=join(',',@list);
    > SELECT * FROM Table WHERE ID in ($list)
    > $sth -> execute

    > SELECT * FROM Table WHERE ID in (${\join(',',@list)})
    > $sth -> execute

Those produce equivalent SQL statements:

  my @list=(1..4);
  my $q1 = "SELECT * FROM Table WHERE ID in (${\join(',',@list)})";
  my $list=join(',',@list);
  my $q2 = "SELECT * FROM Table WHERE ID in ($list)";
  print $q1, "\n", $q2, "\n";
  __END__
  SELECT * FROM Table WHERE ID in (1,2,3,4)
  SELECT * FROM Table WHERE ID in (1,2,3,4)

so it doesn't make any sense why one would work and the other fail.

In response to you original query, you could do something like:

  my @list = 1..4;
  my $q = sprintf('SELECT * FROM Table WHERE ID IN (%s)',
                  join(',' => ('?') x @list));
  my $sth = $dbh->prepare($q);
  $sth->execute(@list);

-Mark


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

Date: Thu, 10 Jun 1999 10:38:05 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Net::SMTP
Message-Id: <Pine.GSO.4.02A.9906101037260.26349-100000@user2.teleport.com>

On Sun, 6 Jun 1999, Daniel Ostroff wrote:

> Am trying to run a simple Perl script using the SMTP module.
> Get the following message:
> Global symbol "%NetConfig" requires explicit package name at
> C:/Perl/lib/Net/SMTP.pm line 30.

It sounds as if there's a bug in your copy of Net::SMTP. Have you asked
the author?

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 10 Jun 1999 10:55:03 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: OLE reference
Message-Id: <375FFBF7.31578FBB@mail.cor.epa.gov>

Jonathan Stowe wrote:
> 
> john kelly <johnt.kelly@worldnet.att.net> wrote:
> > Can anyone please point me to some examples of how to use OLE objects
> > for word.  The doc makes references to looking up the objects in VB or
> > C manuals but I don't have any. Other  then  snip its of code examples
> > here or there, thats all I can find.
 <http://msdn.microsoft.com/officedev/preview/technical/articles/word.asp

Oops.  M$ has re-organized its site, and this page is kaput.

But there are lots of good examples on this.  Read the last part
of the ActivePerl FAQ (titled, oddly enough, "Using OLE with 
Perl") to see good examples, as well as directions toward 
sources and techniques.  One of the best hints in there is
the simplest: (1) run your job with macro recording on; (2)
look at the macro to see the VBA code; (3) follow the directions
to change the VBA calls to Perl calls.

Then use DejaView/Deja to look at past messages in the 
Perl-Win32-users listserv, because they have tons of questions
on this subject every week.

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


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

Date: Thu, 10 Jun 1999 15:53:47 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl "constructors"
Message-Id: <7jon25$ld3$1@nnrp1.deja.com>

In article <7jo353$ea4$1@nnrp1.deja.com>,
  armchair@my-deja.com wrote:
>
> Let's just be clear that by your
> rediculous and meaningless definition assembler is equivalent to all
> languages, so your "portable assembler" applies to Perl as well.

No, not really.  By a meaningful and useful definition of "equivalent"
(though not by others, it seems), C and asm are equivalent, but by
that same definition, Perl is not.  As I have mentioned previously,
C and asm both model the real machine.  The object code generated
by a C compiler is executable on a real cpu, and in fact looks very
much like what you would write by hand, if you were writing in asm.
Perl, on the other hand, models a abstract, "virtual" machine,
(implemented by the perl bytecode interpreter), for which no
assembler exists.  Translation of Perl code into the machine code of
an existing real machine is, shall we say, an extremely non-trivial
task; some people are working hard on it, but it's, um, not ready
for prime time.  Not that this should bother anyone; that's not what
Perl was designed for.  C, of course, was designed to be compiled
directly into tight machine code -- just like assembler.


> My, someone who calls C equivalent to assembler then calls C/C++
> if/while/for logic significantly different from Perl's due to things
> that are "pretty subtle". Let me suggest that if you want to be
> enlightened as to the equivalence feel free to read the Perl and the
> C/C++ documentation. I have read them both and am quite certain that
> should you, you will reach the proper conclusion.

The differences are subtle, but significant, at least to some
Perl programmers.  If the differences aren't significant to you,
there's not much I can say.


> Evidently however
> different the "machine that Perl models", it still uses the same
> if/while/for logic of "the machine that C models".

The equivalence of the if/while/for logic of C and Perl (which I am
not granting is the case) does not in anyway way confirm or deny the
equivalence of C and asm, nor that Perl is a higher level language
than C.  Strange that you think it would.


> No you didn't, you gave an excellent example of why C and assembler
are
> not equal or equivalent.

No, I demonstrated that they are "equivalent" (and therefore
"equal or equivalent").


> But we are not talking about functional equivalence of course. We are
> talking about syntactical equivalence,

No, we're not talking about syntactic equivalence.  That would be
a very stupid thing to talk about.  C and Pascal and identical in
nearly every respect, yet syntactically are very different.
Syntactic difference/equivalence is quite irrelevant.


> > > Again you have proven Assembler to not be the equivalent of C.
> >
> > No, I've shown they're equivalent, though not identical.
>
> Nope, not equivalent, not identical, not the same, not even related,

Equivalent in every respect except syntactically -- which, of course,
is neither here nor there.


> > > I give you credit for being
> > > big enough to disprove you own case.

I did not "disprove my own case", and I don't need your credit for
that or anything else I've done.


> You will have to come up with your definition of equivalent. One that
> will say that using C is equivalent to using assembler, although not
as
> good, or as easy. Good luck.

Nope, I'm not out to show that "using C is equivalent to using asm".
I'm talking about the design of the languages themselves, primarily
the semantics.  Too much of the usability of a language is dependent
on other things, like the availability and quality of development
tools.


> Give me the assembler code for this C code or put in terms that may
make
> it easier for you, given this machine code model in C, show me how the
> assember "machine code model" is equivalent. As always, good luck.

I won't waste my time writing assembly code for you.
If you want the asm equivalent of this code, run it through your
compiler with the "generate asm" option.
I feel confident that you will not be convinced of the equivalence of
the code, regardless of who or what does the translation.


> Show me how this C code is not
> more powerful than the equivalent assembler code by showing me the
> equivalent assembler code...

Ridiculous.


> While C and Assembler are equivalent because although syntactically
> different, the code can do the same thing, a string in C++ is not
> equivalent to a string in Perl, because although syntactically
similar,
> they are implemented differently under the covers.

More or less.  But presumably one could write a C++ string class
that would work very much like a Perl string.  (That would be
nice, I think.)


> > > Were [classes] implemented in complex ways?

I have enough faith in Bjarne's abilities to assume that the
implementation of classes in C++ is no more complex that it has
to be.  And that, of course, is quite complex, by almost any
standard.


> We are only discussing language syntax here, not writing compilers,

No wonder we're arguing: we're talking about two different things.


> > I like C.  I think it's great.  And asm has its place.
>
> Why would Assembler have its place when you have claimed about 15
times
> that C is merely portable assembler, and in the next breath said that
> Assembler takes many more lines of code than C?

Assembly is necessary in a variety of situations, such as:
1. No compiler is available, e.g.
   a. bootstrapping a new architecture
   b. very small or novel processors
2. Speed is of paramount importance, and the available compilers
   can't deliver
3. Certain low-level operations, like os traps or interrupts, require
   access to machine instructions that the compiler doesn't emit.
In such situations, portability, and even ease of programming have
to take a back seat.  Such is life.


> > > Regarding this "portable assembler concept, would you be so
> > > kind as to
> > > give the assembly equivalent of the following C code:
> >
> > Look at the asm output of your C compiler.
>
> Okay, I did, and it's not equivalent to the C code.

It is, you're just not seeing (or admitting) the equivalence.


> The number lines is certainly relevant. That is one of the metrics by
> which we would test to see if the source code of one language is like
> that of another.

Sure, but the results of that test say nothing about the equivalence
of the two languages.


> implying through your inability to
> even give the requested sample code,

Not unable, just unwilling.  I have real work to do.


> > The complexity of the compiler is utterly dependent on the
complexity
> > of the language semantics.  But I thought you knew that.
>
> But we are not discussing compiler design, but language sytax, so the
> complexity of the compiler is irrelevant.

No, we are discussing language complexity, and that means grammar
and semantics complexity, both of which are realized in the
complexity of the compiler.


> > A language is not just syntax.  Even so, the syntax of C++ is an
> > awful lot more complex than C.  Compare the grammars.
>
> Yes, in our discussion a language is just syntax.

I disagree.  And C++ is more complex than C -- by a wide margin --
by just about any measure you care to try.  Even if you only
wish to compare their syntax, you can see that C++ is far more
complex than C.  Unfortunate but true.

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 10 Jun 1999 17:07:27 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: perl debugging in emacs
Message-Id: <7jorcf$jdc$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Dan Pelton 
<dnp@ams.org>],
who wrote in article <7jo7l9$ffp$1@nnrp1.deja.com>:
> Sorry that my question was unclear.
> 
> I am trying to debug a script which is normally invoked from the
> Unix command line by typing "script.pl < large_data_file".

There is no such time as Unix command line.  You mean *shell* command
line, and here lies your confusion.

> I would like to be able to use perldb within emacs.

You need to change the startup data of perldb (do not know where is it
sitting) so that it starts *shell*, not perl.  Or maybe you can start
shell manually (probably not easier).

  sh -c 'perl -d script.pl -emacs < large_data_file'

Ilya


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

Date: Thu, 10 Jun 1999 16:04:07 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Perldoc and Perlfaq
Message-Id: <siemjk2gaw.fsf@cre.canon.co.uk>

Tom Christiansen <tchrist@mox.perl.com> wrote:
> pod2man `pmpath MODULE` | nroff -man

$ perldoc Net::LDAP
User Contributed Perl Documentation                       LDAP(1)
[etc]

  but

$ pod2man `pmpath Net::LDAP` | nroff -man
/apps/perl5/bin/pod2man: Invalid man page - no documentation in /apps/perl5/lib/site_perl/5.005/Net/LDAP.pm

-- 
Gareth Rees


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

Date: 10 Jun 1999 16:27:19 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perldoc and Perlfaq
Message-Id: <slrn7lvq1h.rhn.fl_aggie@thepentagon.com>

On 10 Jun 1999 09:36:03 -0700, Tom Christiansen <tchrist@mox.perl.com>, in
<375fdb63@cs.colorado.edu> wrote:

+ From the pmtools distribution in
+ http://langauge.perl.com/misc/pmtools-1.00.tar.gz that are referenced
             ^^
Transposed those characters:

http://language.perl.com/misc/pmtools-1.00.tar.gz

But:

+ from http://language.perl.com/admin/whats_new.html if that's hard to type:

is fine.

James


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

Date: 10 Jun 1999 19:50:34 +0200
From: Chmouel Boudjnah <chmouel@mandrakesoft.com>
To: tchrist@mox.perl.com (Tom Christiansen)
Subject: Re: Perldoc and Perlfaq
Message-Id: <87vhcwaqs5.fsf@vador.mandrakesoft.com>

Tom Christiansen <tchrist@mox.perl.com> writes:

[...]

> http://langauge.perl.com/misc/pmtools-1.00.tar.gz that are referenced
            ^^^
control-t on emacs (or shell) it's cool (language no langauge).

> from http://language.perl.com/admin/whats_new.html if that's hard to type:

BTW: It's very powerful tools in UNIX philosophy.
-- 
MandrakeSoft          http://www.mandrakesoft.com/
http://linux-mandrake.com         	 --Chmouel


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

Date: Thu, 10 Jun 1999 09:03:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: print command (<<) in perl CGI
Message-Id: <MPG.11c9818e46c6ebf0989bae@nntp.hpl.hp.com>

In article <375FCC05.A28D919D@bigfoot.com> on Thu, 10 Jun 1999 16:30:29 
+0200, Andrzej Filip <anfi@bigfoot.com> says...
> sunil@india-times.com wrote:
> > I am writting a script in perl for one of my web application. when i
> > execute the script instead of showing the ouput on the screen
> > it generate/create a file and put the output in that file and offer it
> > as if unknown/new file type to save.

To sunil:

Then that is a server or browser problem, not a Perl problem.  There are 
better newsgroups to ask in than this one.

> <      Here is the piece of code Pls. expedite the things.
> >
> > $nn=<<"EOT"
> >  <HTML>
> >  <BODY>
> >  <P>hello $$</P>
> >  </P>
> >  </BODY>
> >  </HTML>
> > EOT
> > ;
 ...
> Put semicolon after "EOT"
> ---------------------------->
> $nn=<<"EOT";
>  <HTML> <BODY>
>  <P>hello $$</P>
>  </BODY> </HTML>
> EOT
> <----------------------------

To Andrjez:

That is totally irrelevant.  White-space in expressions is ignored in 
Perl.

You should try such a thing both the original way and your suggested 
way, before wasting people's time with such a post.

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


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

Date: 10 Jun 1999 17:10:47 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Problems sorting. I'm stupid and I'll die
Message-Id: <7jorin$mbq$1@pegasus.csx.cam.ac.uk>

In article <MPG.11c8a5243c73bb58989ba1@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>
>There *is* a 'split' function.  The formulation
>
>  (split /,/)[2]
>
>didn't seem to work, though.
>
>Nothing dies around here.  Perl 4.036 is still running programs for real 
>users.

Seems like your knowledge of perl4's anal attitude towards brackets has
died.   :-)    This is valid perl4:

   (split(/,/))[2]


Mike Guy


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

Date: Thu, 10 Jun 1999 17:32:59 GMT
From: dalehend@flash.net
Subject: Re: Regexpr for loop to handle e-address list
Message-Id: <375ff53a.2100480@news.flash.net>

The quoted string of email addresses is stored in a BBS config file
for the value of a variable. So its not just of string email
addresses, it is a string of email addresses stored in a variable in a
config file. The problem was that the special characters had to be
delimited in order for the variable values to be checked against text
input from a menu.
I think Text::ParseWords will handle it. will see.


>But the whole point is that there *may well be* quotes in an e-mail
>address and there are unlikely to be any backslashes in the place
>
>No slashes no quotes.  The point of the example I gave you was to
>demonstrate that Mail::Address can handle the full range of mail
>addresses - Including those with spaces quotes funny characters and all ...
>
>Infact in your assignment there you could lose the backslashes
>altogether if you changed to single quotes.
>
>If you have a file with some Perl source in it why dont you just use
>do() on the file to get $emaillist defined and then use Mail::Address to
>split the addresses up.
>
>/J\
>-- 
>"Over the years I've always had Max Factor in my box" - Tina Earnshaw,
>Chief Make-Up Artist, Titanic



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

Date: Thu, 10 Jun 1999 11:01:04 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Script times-out after x minutes
Message-Id: <x3yaeu8qevj.fsf@tigre.matrox.com>


<mikane@shell3.ba.best.com> writes:

> I have a Perl script (client) that executes a program on another UNIX box
> (server) using RPC. The server has timeouts which sometimes fail stalling
> the client. How can I code the client such that it terminates execution
> after 5 min while it is waiting for a responce fron the server.

You can code the client using your favourite editor, but only after
reading perlfaq8:

	How do I timeout a slow event?

HTH,
Ala



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

Date: 10 Jun 1999 17:34:42 GMT
From: darstec@aol.com (DarStec)
Subject: Re: sendmail doesn't work
Message-Id: <19990610133442.24730.00001323@ngol05.aol.com>

In article <7jb91i$44b$1@gellyfish.btinternet.com>, Jonathan Stowe
<gellyfish@gellyfish.com> writes:

>
>On 05 Jun 1999 04:08:42 GMT DarStec wrote:
>> In article <375616E1.E5C2BFD1@chatbase.com>, TRG Software : Tim Greer
>> <webmaster@chatbase.com> writes:
>>>
>>>Free web server offering CGI... And you bring those troubles here? :-)
>>>
>> 
>> Let me get this right.  Those that can't afford $100 or more a month for a
>> "real" web host are not suppose to learn Perl, and should be excluded from
>> asking questions and learning in this newsgroup? 
>> 
>
>Leaving aside the fact that the sentence was followed by :-) which  should
>indicate to the reader the spirit in which it should be taken - I dont
>see anywhere in that sentence where what you are saying is suggested.
>
>I think however that this group is not the appropriate place to be
>asking questions about running Perl programs on a particular server, I would
>hope that those services have helpdesks for things like that - and if they
>dont then you should be considering whether you are really getting value
>for money (yes even for free) from that service.
>
>/J\ 
>-- 
>Jonathan Stowe <jns@gellyfish.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
>Hastings:
><URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
>

Far too often, when making a snide comment, usenet authors use the ":-)"
emoticon as a COVER for their criticism and sarcasm.  Judging from the
"attitude" of many regulars of this newsgroup, I chose to interpret this
instance as such.  Look at the sentence and think about it for a minute: "Free
web server offering CGI... And you bring those troubles here?"  In what other
way can it be interpreted?

Maybe some Perl and C programmers are so used to using cryptic,
related-to-nothing shortcuts, instead of real words, that they forget that the
rest of the world uses actual and many words to convey thoughts.

Free Web Servers are not FREE.  Somebody (advertisers) are pay some big bucks
to the Web Servers.  For those that have their web page there it is a concept
of OPM (Other People's Money) which I am sure is a concept many recognize.

Unfortuately help desks are very sorry for most Web Host Servers that I've run
across.  The customer only paying $100 a month, usually looses out to the
Fortune 500 company paying tens of thousands of dollars a month.  And pray
tell, how can a newbie tell whether the problem is in the Perl code or Server
related, or even a particular interpretation of the Perl code on that server?

Later,
Darrell Stec                               E-Mail: DarStec@aol.com

Webpage Sorcery
http://webpagesorcery.com
We Put the Magic in Your Webpages




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

Date: Thu, 10 Jun 1999 15:29:50 GMT
From: Don Roby <droby@copyright.com>
Subject: Re: Separating array into alphabetical array of arrays
Message-Id: <7joll0$kom$1@nnrp1.deja.com>

In article <slrn7ltqhu.bdg.dragons@dragons.duesouth.net>,
  dragons@dragons.duesouth.net wrote:

<snip variant already corrected by lr>

>
> or, put it in a hash by letter:
>
> my %letters;
>
> for ( @lines ) {
>     next unless /^([a-zA-Z])/;
>     $letters{lc $1} = $_;
> }
>

Unless you're planning on holding onto only the last line with each
beginning letter, I think you might want a hash of lists here:

for ( @lines ) {
     next unless /^([a-zA-Z])/;
     push ($letters{lc $1}, $_);
}

And then of course, you loop through the keys of the hash and write each
list in your hash of lists out to a file whose name depends on the key.

It should also be noted that this method uses lots more memory, but
doesn't depend on the stuff being previously sorted.  The other method
depended on the data being sorted with (lc($a) cmp lc($b)).

--
Don Roby


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Thu, 10 Jun 1999 15:43:26 GMT
From: Don Roby <droby@copyright.com>
Subject: Re: Separating array into alphabetical array of arrays
Message-Id: <7jomeq$l4l$1@nnrp1.deja.com>

In article <7joll0$kom$1@nnrp1.deja.com>,
  Don Roby <droby@copyright.com> wrote:

<snip>

>
> for ( @lines ) {
>      next unless /^([a-zA-Z])/;
>      push ($letters{lc $1}, $_);
> }
>

Make that push(@{$letters{lc $1}}, $_);

push does need an array, not a reference...

Sorry for talking to myself this way, but deja wouldn't let me cancel.
Guess it's time to get a real news setup.

Or maybe I should have just waited and let lr correct me... ;-)

--
Don Roby


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Thu, 10 Jun 1999 10:21:20 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: strange problem for multithread programming...
Message-Id: <Pine.GSO.4.02A.9906101018230.26349-100000@user2.teleport.com>

On 10 Jun 1999, GEMINI wrote:

> Not a GLOB reference at /usr/local/lib/perl5/5.00502/SelectSaver.pm
> line 43.
> 
> However, I didn't use the SelectSaver module,

Probably not your fault, then...

> and maybe it is invoked by the modules I use:
> use Thread;
> use Thread::Semaphore;
> use IO::Socket;

 ...so long as you're using those modules correctly.

> Another error is "Attempt to free unreferenced scalar....." 

This can't be your fault (unless you've been using your own non-Perl
code). 

> These errornous don't happen for every execution,
> but happen so often. So do I have to trace the module to 
> find out the reason?

The best is if you can make a small program which reliably shows the bug.
Then someone can track it down and fix it. But first, make sure you're
using the most recent versions of Perl and those modules, since someone
may have already fixed that bug. 

Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 10 Jun 1999 09:41:27 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Substitution with functions
Message-Id: <MPG.11c98a8711eddee5989bb3@nntp.hpl.hp.com>

In article <fa2oj7.b95.ln@magna.metronet.com> on Thu, 10 Jun 1999 
05:59:43 -0400, Tad McClellan <tadmc@metronet.com> says...
> Herve Foucher (Herve.Foucher___NO_SPAM@helio.org) wrote:
 ...
> : >    $a_string =~ s/##(\w+)#/&MyPerlFunction($1)/ge;
> 
> : It works! But I prefer using $&
> : Why do you use $1 ?
 ...
>    So the answer to your question is:   It is faster.

Isn't there a better answer than that?  'It is correct.'

'xyz##whatever#pdq' =~ /##(\w+)#/;

The value of $& is '##whatever#', but the value of $1 is 'whatever'.

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


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

Date: 10 Jun 1999 17:27:07 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: What's the "halting problem"?
Message-Id: <7joshb$nen$1@pegasus.csx.cam.ac.uk>

Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>
>It's too bad we can't prove that Y2K == Halting Problem.
>
>Or can we?

Of course we can, trivially.

Consider the class of expressions of the form

         my_complcated_function() ? "19$year" : 1900+$year;

Determining whether that has a Y2K bug is clearly equivalent to the halting
problem.


Mike Guy


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

Date: Thu, 10 Jun 1999 10:43:14 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Where is sendmail on NT using Perl
Message-Id: <375FF932.8DEBED1@mail.cor.epa.gov>

RG wrote:
> 
> My sysop is out of town , but is not real familiar with perl, and I need
> to know where to point my formmail.pl script's tag to "sendmail" on the
> NT server. I believe the right path would be d:/perl/lib/sendmail

Umm, probably not.  First, as two people have already pointed out,
sendmail (while the de facto standard on unix) is not the usual
mailer on NT boxes.  There *may* be a sendmail program on your
NT server (there are two versions I know of for NT, one of them 
by M$), but the mailer may be blat or wrmail or another choice.
You have to find out from your sysop.  You may want to read the
ActivePerl FAQ which comes with ActiveState Perl.  It has a 
section (section 5) titled "Windows 95/NT" which includes a
detailed discussion on sending mail from NT.

And second, I find it unlikely that a sysop would put a non-Perl
system program like sendmail/whatever in a /perl/lib/...
hierarchy.  You have to find out from your sysop.

Matt Wright's formmail.pl program was written assuming that
your sysop would be running some flavor of unix.  So the 
script may break in other places as well.  _Caveat_utor_.

> $mailprog="d://perl//lib//sendmail";
> or
> $mailprog="d:/perl/lib/sendmail";

While the second may work (depending on the rest of the code),
the first is unlikely to work anywhere.  I think you meant
something like "d:\\perl\\lib\\sendmail" .
 
> Both of these do not work, as the form doesnt get sent to my email
> address. I do not get an error message, though.

The error messages may all be going to the server log.

If your sysop is not using a standard sendmail, you may have
to re-write some of the mailing code.. or ALL the mailing
code.  So read that section of the ActivePerl FAQ and study
the examples therein.

> Thanks in advance

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


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5950
**************************************

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