[9935] in Perl-Users-Digest
Perl-Users Digest, Issue: 3528 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 24 18:07:24 1998
Date: Mon, 24 Aug 98 15:00:20 -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 Mon, 24 Aug 1998 Volume: 8 Number: 3528
Today's topics:
Re: "protocol not supported" with socket() <zenin@bawdycaste.org>
Are $a and $b some special variables? <joreb@algonet.se>
Re: Are $a and $b some special variables? (Karlon West)
Re: Are $a and $b some special variables? (Craig Berry)
Re: Attention Webmasters!!! no.unsoliciteds@dead.end.com
Re: better way to truncate string after certain number (Mark-Jason Dominus)
Re: chop bug (Karlon West)
Re: chop bug (Andrew M. Langmead)
Re: Code Style (Was: How to sort this associative array <zenin@bawdycaste.org>
Maximum dbm database record size (Tomas)
Re: Perl documentation (Mark-Jason Dominus)
Re: Perl FAR version 1.1.1 MAKE SURE YOU READ THIS BEFO (Andrew M. Kuchling)
Re: Perl FAR version 1.1.1 MAKE SURE YOU READ THIS BEFO no.unsoliciteds@dead.end.com
PerlBots (Harry McGreggor)
Re: Perlscript: where is documentation <founder@pege.org>
Re: Prime numbers [was Re: here's an implementation of (Michael J Gebis)
Re: Prime numbers [was Re: here's an implementation of (Sean McAfee)
Re: Prime numbers [was Re: here's an implementation of (Craig Berry)
Question using pack <warren@poci.amis.com>
Re: regex question: striphtml and misformed tags <dgris@rand.dimensional.com>
Scheduling Perl with Win NT AT Svc <alext@cri-boi.nospam.com>
Re: Sigh no.unsoliciteds@dead.end.com
Threading/forking simple(?) programs (Duke)
Win32 Q: Reading Outlook 98 files <walter@tscinternet.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Aug 1998 21:12:43 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: "protocol not supported" with socket()
Message-Id: <903993090.320342@thrush.omix.com>
[posted & mailed]
Gregor Mosheh <gregor@novoironlight.com> wrote:
: I've freshly installed PERL on our new system. When I try to use the
: socket() function, I get a "Protocol not supported" error at runtime.
...You code please. We can't do a thing for you without a
small test case and the *exact* error message you received when
running it. -And by test case I don't mean the two or three lines
around the error, but the *entire* script that you are using to
cause the error. -Your real error could easily be before the
socket() call.
Also including the complete output of the command "perl -V" can be
helpful as well.
Thanks!
: I've tried compiling with loadable modules disabled, specifying that
: Socket be statically compiled in - doesn't help. "make test" reports all
: tests OK.
There is no need for the Socket module to be statically compiled in.
The socket() function is part of perl's core, and does not need or
use the Socket module at all.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Mon, 24 Aug 1998 23:08:53 +0200
From: "Ekenberg" <joreb@algonet.se>
Subject: Are $a and $b some special variables?
Message-Id: <6rskou$385$1@cubacola.tninet.se>
Although I can't find $a or $b in the Camelbook's list of special global
variables, they behave strangely in the following examples, at least on my
Win 95/Perl system:
------------------------ ex 1 ---------------------
use strict;
my $a = "ab";
my $b = "cd";
$c = "ef";
print $a,$b,$c;
-----------------------------------------------------
Will of course not compile, since it lacks my-declaration in front of $c.
_But_ if we let $a and $b be without my-declaration instead:
------------------------- ex 2 ---------------------
use strict;
$a = "ab";
$b = "cd";
my $c = "ef";
print $a,$b,$c;
------------------------------------------------------
..it compiles without a word of complaint and produces "abcdef".
Why??
/Johan Ekenberg
------------------------------
Date: 24 Aug 1998 21:28:44 GMT
From: karlon@bnr.ca (Karlon West)
Subject: Re: Are $a and $b some special variables?
Message-Id: <6rsluc$6aa@crchh14.us.nortel.com>
Ekenberg (joreb@algonet.se) wrote:
> Although I can't find $a or $b in the Camelbook's list of special global
> variables, they behave strangely in the following examples, at least on my
> Win 95/Perl system:
> use strict;
> $a = "ab";
> $b = "cd";
> my $c = "ef";
> print $a,$b,$c;
> ------------------------------------------------------
> ..it compiles without a word of complaint and produces "abcdef".
> Why??
Camel 2nd ed., page 219, 1st paragraph.
To paraphrase: $a and $b are package globals exempt from
"use strict" restrictions.
------------------------------
Date: 24 Aug 1998 21:50:31 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Are $a and $b some special variables?
Message-Id: <6rsn77$l3j$5@marina.cinenet.net>
Ekenberg (joreb@algonet.se) wrote:
: Although I can't find $a or $b in the Camelbook's list of special global
: variables, they behave strangely in the following examples, at least on my
: Win 95/Perl system:
[snip]
They are special in comparison blocks for the sort function; see
perlfunc's section on sort. It appears that $a and $b are predeclared
globals in each package. Perhaps they should be added to the various
lists of special globals?
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: Tue, 25 Aug 1998 06:10:11 +0900
From: no.unsoliciteds@dead.end.com
Subject: Re: Attention Webmasters!!!
Message-Id: <35E1D6B5.D2227A5F@dead.end.com>
Host Investigator wrote:
This is one of those sneaky ad things right? Where they leave you looking at a
white billboard with a surreal slogan pasted on it for 3 weeks before they
move into phase 2 and actually put the product on there
------------------------------
Date: 24 Aug 1998 17:55:25 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: better way to truncate string after certain number of "."
Message-Id: <6rsngd$5cr$1@monet.op.net>
In article <1oiE1.633$pY1.3673837@news2.voicenet.com>,
Matt Knecht <hex@voicenet.com> wrote:
>John Porter <jdporter@min.net> wrote:
>>Or just use Mark-Jason's excellent Memoize module.
>Sometimes I just want a quick, concise, simple solution
>that works for my particular data set. A lot of times it's impratical
>to wait the extra 5 seconds Date::Manip requires. It seems equally
>impractical to install a full blown cache handler just for one instance.
Yeah, and there's nothing that `memoize' is going to get you that your
own cache handler won't; your is probably more efficient anyway,
because it doesn't have to code for features you don't use. The big
reason for `memoize' is to introduce people to the idea, and to make
it easy for people who don't know much about it to drop it in. And,
of course, if you have it handy, it's easy to drop it in even if you
do understand it yourself.
Eventually, Memoize might be useful for execution profiling, but I
need to finish the persistent disk caching part before I do that.
------------------------------
Date: 24 Aug 1998 20:29:32 GMT
From: karlon@bnr.ca (Karlon West)
Subject: Re: chop bug
Message-Id: <6rsifc$23l@crchh14.us.nortel.com>
rockwell@shr.dec.com wrote:
> $str=".0123";
> while ($c=chop $str) {
> print "$c\n";
> }
> print "\n";
> the above program dies when it hits the zero character, substitute some other
> alphanumeric and it works as expected.
> This is perl, version 5.001
Unless I'm really missing something, the following sentence
from "man perlsyn" answers this:
The while statement executes the block as long as the expression is
true (does not evaluate to the null string or 0 or "0").
If "$c" equals "0" then the expression, by definition, is
false.
Karlon
------------------------------
Date: Mon, 24 Aug 1998 21:22:23 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: chop bug
Message-Id: <Ey7q1C.5tL@world.std.com>
rockwell@shr.dec.com writes:
>the above program dies when it hits the zero character, substitute some other
>alphanumeric and it works as expected.
Perl treats the number 0, the string "0", and the empty string as
boolean false values. The while construct determines the boolean
result of the expression within its parenthesis, and performs the loop
each time the expression evaluates to a boolean true value (which is
everything other than the number 0, the string "0", and the empty
string.) And its obvious, but just to finish things out, chop returns
a one character string consisting of the character removed from the end
of the string.
One workaround to your problem would be to say:
while (length($c=chop $str)) {
Once chop has removed every character from the string, it returns an
empty string. Since an empty string (and only an empty string) has a
length of 0, the expression in the parenthesis of the while loop will
evaluate to a boolean false value, and the loop will stop being
executed.
--
Andrew Langmead
------------------------------
Date: 24 Aug 1998 21:43:45 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Code Style (Was: How to sort this associative array?)
Message-Id: <903994944.291571@thrush.omix.com>
(Jari Aalto+mail.perl) <jari.aalto@poboxes.com> wrote:
: We use "modern" line-up style:
: for (
: ..code
: )
: {
: ## Insert nifty code here
: }
This makes code in a language that allows bare blocks to be used
at will much harder to read correctly.
IMHO, the first thought of most when seeing a bare set of {} is
to think "anon block":
{
some lexical scoped stuff that has
nothing to do with anything else around, not even a for() loop
}
As there is nothing to relate or attach the first { with, the for()
loop is easily lost.
Such "modern" code style is good for things like python that have no
block delimiters, but just needlessly makes code in strictly blocked
C style languages harder to read IMO.
: And this would be:
: for ( sort
: {
: $spool->{0}->{ng}->{$b}->{count}
: <=>
: $spool->{0}->{ng}->{$a}->{count}
: }
: keys %{$spool->{0}->{ng}}
: )
>snip<
With the start and end ("for(" and ")") not lined up, one now has to
start searching (needlessly) for where the for() ends.
: {
: printf(
: "\t %-5s : %s\n",
: commify($spool->{0}->{ng}->{$_}->{count}),
: $_
: );
: }
This still screems "anon lexical scooped block" in Perl. You also
are breaking your own rules here. -Ie, why isn't your printf() and
commify() lined up like this:
printf (
"\t %-5s : %s\n",
commify (
$spool->{0}->{ng}->{$_}->{count}
),
$_
);
Ugly huh? This rule doesn't last long when applied to many
conditions. As soon as the start of the for() loop can't be viewed
on the same screen as the start of the loop, using an indented second
parens style falls apart quickly too.
: In our style, the start/end delimiters can be leveled just
: above the function, like:
: use var qw
: (
: $VAR
: %HASH
: @LIST
: );
I really hope this just a tab problem, but still this is very
confusing when used in Perl code.
Not to mention the fact you are again breaking your own code
style here. You are now putting the first paren on its own
line, but matching up the second paren with the keyword (use)
and the first paren, similar to the balanced style I displayed.
: An in above that was adjusted to sort(), but could also be:
: my
: (
: $arg1,
: $arg2,
: $veryLongArgNameOrSomethingLikeThat,
: $arg3
: ) = @ARG
If the first paren was put directly after the my like this:
my (
...stuff...
) = @ARGV;
I'd agree with this style.
In C/C++ where you often need many other statements after the
first keyword (such as function declarations), putting the first
paren on its own line makes sense, but such use in function
declarations is normally the only exception to this rule. Using
and indented second paren however, is highly unfavored by pretty
much everyone I've ever know, simply because it makes it harder to
find the block end if it doesn't line up with the block start.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Mon, 24 Aug 1998 21:16:35 GMT
From: hnm501r@tninet.NOSPAM.se (Tomas)
Subject: Maximum dbm database record size
Message-Id: <35f0d829.6206256@news1.tninet.se>
I asked myself the question what's the maximum size of a perl dbm file
database record, and after doing some testing (see the piece of code
below) it seems to me as the sum of the length of the record and the
length of the index, can be maximum 1008.
(I am running ActiveWares Perl for Win32 Build 316 , version 5.003_07
on a Win95 machine with an AMD K5 PR133 CPU)
Is this true in general, or only on my platform, and
is the maximum dbm record size documented somewhere, and=20
is there a list of the maximum size on different platforms (if there
are differences) ???
dbmopen(%test, "test", 0777);
$test{"123"} =3D"A" x 1005; # OK
$test{"12345678"}=3D"A" x 1000; # OK
# $test{"123"} =3D"A" x 1006; # not OK
# $test{"12345678"}=3D"A" x 1001; # not OK
dbmclose (%test);
When I try to run any of the lines marked above "not OK" the program
exits with the error message: "sdbm store returned -1, errno 2,..."
------------------------------
Date: 24 Aug 1998 17:45:51 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Perl documentation
Message-Id: <6rsmuf$lai$1@monet.op.net>
In article <35E1B8EB.95CFB4D2@dead.end.com>, <no.uce@dead.mailbox.com> wrote:
>Mark-Jason Dominus wrote:
>
>> I think the problem with you is that you're too lazy to think about
>> what you really mean, and that's why you end up criticizing a lot of
>> helpful people who don't deserve it.
>
>Ummm, now let me get this straight
> [etc.]
No, completly wrong. Here it is again: I am dismayed that you are in
such a hurry to badmouth people you don't like that you don't bother
to think who they are, and in your carelessness you end up insulting a
whole lot of people who are actually working very hard to solve the
problem you meant to be complaining about.
>The trouble is people like you Mark, stand up for those that seem
> ... outside ... normal human behaviour.
I was not standing up for rude people. I was putting down rude
people, including you, which is not the same thing.
If you have a point to make, I think you should be able to make it
without lumping together a whole lot of people who have probably not
done anything offensive. You said the problem was `perl gurus'. I
would consider Randal Schwartz a guru, and I take issue with your
complaints about him. Russ Allbery and Jan Krynicky and Craig Berry
and Mike Guy and brian d foy and Larry Rosler and Nat Torkington are
also frequent contributors here, and could all be considered gurus,
and you insulted them all and called them a problem, even though
nobody but you has ever complained about any of them.
And as far as I can tell, the only reason you did that shameful thing
was because you were too lazy to think about what you were saying and
who you were really talking about, and you settled for a sloppy insult
that splattered everyone, instead of taking the time to think about
what you really meant and what your point was, and formulating a more
specific complaint. Did you mean to complain about these people? If
you did, you were not very specific, and I think you were wrong. If
not, as I suspect, you were at best klutzy.
Now I see that you think I am part of the problem too, because I take
exception when some anonymous twerp like you wanders in here and
insults my friends, people who work hard to answer many questions
politely and correctly. `Insult' is the right word here, because your
whining is not a legitimate complaint. It was not targeted at
specific individuals or behaviors, but rather at `the gurus'. Maybe
you meant to target specific individuals, but if you did mean to, you
were not successful. You just went ahead and slammed everyone,
without thinking about what you were saying.
If I were going to say what `the trouble is', I would trace it to
people who whine and complain about `the trouble'. Some of these
whiners are experienced programmers who whine and complain about the
newcomers, and some of the whiners are are newcomers who are whining
and complaining about the experienced programmers. I find them all
intensely boring.
I must agree, it certainly is much easier to whine and complain than
to set a good example. But if you think your whining and complaining
and insulting `the gurus' is going to solve `the trouble', you have
your head up your butt. Maybe it makes you feel better to do it, but
it also makes you a whining hypocrite.
This is not a request for you to clarify your complaints, or to target
them more specifically. Nor is it a demand for an apology to the
people you carelessly insulted. It is an expression of hope that you
will stop whining and to try instead to set a good example by posting
intelligent questions, polite, correct answers, and other Perl-related
messages.
I am going to stop complaining now and go back to trying to set a good
example.
------------------------------
Date: 24 Aug 1998 17:06:04 -0400
From: akuchlin@cnri.reston.va.us (Andrew M. Kuchling)
Subject: Re: Perl FAR version 1.1.1 MAKE SURE YOU READ THIS BEFORE POSTING
Message-Id: <3d4sv2t7ib.fsf@amarok.cnri.reston.va.us>
no.unsoliciteds@dead.end.com writes:
> What do _you_ think this news group exists for? So well informed practiced
> perl programmers can chat with other well informed practiced perl programmers
> about the books they read to become what they are and their accomplishments
> to date?
Yes, definitely. Well informed programmers can also discuss:
* Suggestions for new features and enhancements.
* Suggestions for related tools (things like SWIG).
* Stylistic questions about program design and structure: when
to use classes, and when not to?
* Theoretical questions about the philosophy of system design:
why is feature X good, and why is feature Y not so good?
* In-jokes, making Monty Python references, and other silly
threads. (You can't be serious all the time.)
You can see this sort of environment in many forums, from
linux-kernel to perl5-porters to python-list to gimp-developers to
lynx-dev. Experienced programmers can always find *something* to
discuss; because they know more, they have a wider range of topics to
choose from. Discussion forums need to walk a fine line; newbie
questions, while usually simple and quickly answered, sometimes spark
interesting higher-level discussions. Too many newbie questions,
though, send the gurus off in search of somewhere more interesting.
(Not a lot of deep discussion of Linux kernel design takes place in
comp.os.linux.* any more.)
--
A.M. Kuchling http://starship.skyport.net/crew/amk/
"There is no disputing about tastes," says the old saw. In my experience there
is little else.
-- Robertson Davies, _Marchbanks' Almanac_ (1967)
------------------------------
Date: Tue, 25 Aug 1998 06:55:36 +0900
From: no.unsoliciteds@dead.end.com
Subject: Re: Perl FAR version 1.1.1 MAKE SURE YOU READ THIS BEFORE POSTING
Message-Id: <35E1E15A.2B6BA061@dead.end.com>
Andrew M. Kuchling wrote:
> Experienced programmers can always find *something* to
> discuss; because they know more
That's just the problem, the abusive posters think just that "I'm right, I
know more". I'm not an experienced programmer but I know enough to spot a
question that has been asked more than once in living memory - rather than
resorting to wasting time writing "it'S in the FAQ you short sighted git" and
thereby guaranteeing an incredible large volume of traffic of pro and contro
abuse, I go look for something more interesting.
Check out the posting "Statistics for comp.lang.perl.misc" the bulkiest
threads were those that degenerated into petty verbal mud slingings caused by
somebody knowing too much Perl and not enough common sense.
------------------------------
Date: Tue, 25 Aug 1998 01:19:22 GMT
From: harry@dublin.net (Harry McGreggor)
Subject: PerlBots
Message-Id: <35e1f956.41216102@news.netcom.ca>
Hi Leon,
Well done on dabot, I've taken a look at your site and I'm very
impressed!
It's the first robot I have seen which uses msql to query a database.
How long did it take you to develop dabot?
I've been toying around with the Eliza module this past week - I'm
still to produce something 'useful' though :-)
Do you read TPJ? There was quiet a good article regarding perl bots in
the latest issue - I've spoken to the editor and he is going to start
up an AI column (the editor once stuided AI at MIT, so he's pretty
happy publishing AI related material)
I'm still to find any decent web-sites which contain tutorials/example
code for perl bots, do you know of any?
Is the source code for dabot available? I'm very keen to have a look
at the source code for your bot, it looks quiet advanced and I
especially like how you use msql to query a database.
Well, nice chatting to you Leon! If I find any good information
regarding perl bots I'll be sure to pass it onto you.
Regards,
------------------------------
Date: Mon, 24 Aug 1998 22:41:57 +0200
From: "Mosl Roland" <founder@pege.org>
Subject: Re: Perlscript: where is documentation
Message-Id: <6rsn39$k5c$1@orudios.magnet.at>
Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz> wrote in message
35E22CE2.3FE8@comenius.ms.mff.cuni.cz...
>Yes most people, especialy unix oriented, miss the difference between
>a perl script and PerlScript.
>
>You should start at http://www.activestate.com , there
>are also a few pointers to FAQs etc.
>
>Jenda
>
>BTW: For those that do not know what is the difference.
>PerlScript is a scripting engine made by ActiveState Tool corp.
>This engine allows you to use Perl in ASP pages, in HTML pages instead
>of JavaScript or VBScript, in Windows Scripting Host (I don't know why
>would anyone want to do this) and in a growing list of applications.
Because it's not possible to write files in JavaScript.
Because I developt a Web Site Compiler in Perl and
now I want to add a graphic user interface to it.
Most easy way to add a graphic user interface to
a perl progam is to put the perl in a html page and
make some changes. After this, it's PerlScript
Mosl Roland
http://pege.org/ clear targets for a confused civilization
http://salzburgs.com/ (did not find a slogan :-)
------------------------------
Date: 24 Aug 1998 20:58:03 GMT
From: gebis@welsh.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Prime numbers [was Re: here's an implementation of diff in perl]
Message-Id: <6rsk4r$arh@mozo.cc.purdue.edu>
cberry@cinenet.net (Craig Berry) writes:
}M.J.T. Guy (mjtg@cus.cam.ac.uk) wrote:
}: Craig Berry <cberry@cinenet.net> wrote:
}: >The only way to detect prime-ness is to divide by all potential factors
}: >and get a remainder on each.
}: False. All modern (and even some quite ancient) methods use quite
}: different approaches to determine primality or to factorise.
}Yes, but don't they all reduce to culling the list of potential factors,
}which I mentioned as the only available optimization? (That's my
}understanding, but I'm not a mathematician; if not, I'll do my Emily
}Latella imitation.)
If you mean that you still have to do a long series of trial
divisions of a list of "potential" factors, and that the only
optimization is to change what gets into the list of "potential
factors," then the answer is still no.
http://www.utm.edu/research/primes/proving.html
See the section on APR, APRT-CL, and ECPP.
Also, see www.mersenne.org.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Mon, 24 Aug 1998 21:18:24 GMT
From: mcafee@moonpatrol.rs.itd.umich.edu (Sean McAfee)
Subject: Re: Prime numbers [was Re: here's an implementation of diff in perl]
Message-Id: <AMkE1.1916$QT4.9437688@newbabylon.rs.itd.umich.edu>
In article <r8zpcyvrju.fsf_-_@asc.sps.mot.com>,
Martin Gregory <mgregory@asc.sps.mot.com> wrote:
>abigail@fnx.com (Abigail) writes:
>> perl -wle '(1 x $_) !~ /^(11+)\1+$/ && print while ++ $_'
>Is this some well known trick for detecing prime numbers?
>How does it work?
I came up with a variant of Abigail's technique:
perl -le '(1 x ++$_) !~ /^($p)\1+$/ && (print, $p.="|1{$_}") while $_+=$_!=2'
Instead of testing every divisor between 2 and $n-1, it only tests the
prime divisors which have already been found.
To my great surprise, this algorithm is actually somewhat faster than the
original, despite the rapidly-growing complexity of the regular expression.
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: 24 Aug 1998 21:34:26 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Prime numbers [was Re: here's an implementation of diff in perl]
Message-Id: <6rsm92$l3j$4@marina.cinenet.net>
Michael J Gebis (gebis@welsh.ecn.purdue.edu) wrote:
: cberry@cinenet.net (Craig Berry) writes:
: }M.J.T. Guy (mjtg@cus.cam.ac.uk) wrote:
: }: Craig Berry <cberry@cinenet.net> wrote:
: }: >The only way to detect prime-ness is to divide by all potential factors
: }: >and get a remainder on each.
: }: False. All modern (and even some quite ancient) methods use quite
: }: different approaches to determine primality or to factorise.
:
: }Yes, but don't they all reduce to culling the list of potential factors,
: }which I mentioned as the only available optimization? (That's my
: }understanding, but I'm not a mathematician; if not, I'll do my Emily
: }Latella imitation.)
:
: If you mean that you still have to do a long series of trial
: divisions of a list of "potential" factors, and that the only
: optimization is to change what gets into the list of "potential
: factors," then the answer is still no.
[refs snipped]
Thanks! Learn something new every day, and often something you thought
you already knew. :) And, as promised:
"Oh. Never mind."
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: Mon, 24 Aug 1998 15:41:50 -0700
From: "Cliff R. Warren" <warren@poci.amis.com>
Subject: Question using pack
Message-Id: <35E1EC2E.35A839F5@poci.amis.com>
I'm pulling my hair out trying to convert simple decimal numbers
into hexadecimal and binary...
Assuming that I use pack for this, I'm can't seem to get the template
correct for the input decimal number. From the Camel book, I assume
it to be "I", as in:
$packed = pack ("I", 4095);
$unpacked = unpack ("H4", $packed);
print "$unpacked\n";
This, nor anything else I place in the place of "I" seems to work. What
am I doing wrong?
I can get pack working when the original data is hex or binary, but not
when it is regular decimal format.
TIA, Cliff Warren
------------------------------
Date: Mon, 24 Aug 1998 21:36:09 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: regex question: striphtml and misformed tags
Message-Id: <6rslhr$7ud$1@rand.dimensional.com>
[posted to comp.lang.perl.misc and mailed to the cited author]
In article <6rk7re$d9s$1@client3.news.psi.net>
abigail@fnx.com wrote:
>Too bad there isn't an operator that says: be as greedy as you can, and
>*never* give back what you once took.
But there is :-).
#!perl
$_ = 'qqqqq';
print "backtracking: captured $1\n" if /(q*)q/;
print "failed, no backtracking\n" unless /(?>q*)q/;
__END__
I believe this made it into the docset for 5.005. Probably
in perlre.
dgris
--
Daniel Grisinger dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
Dave Clark
------------------------------
Date: Mon, 24 Aug 1998 15:32:39 -0600
From: Alex Tatistcheff <alext@cri-boi.nospam.com>
Subject: Scheduling Perl with Win NT AT Svc
Message-Id: <35E1DBF7.61C37FBC@cri-boi.nospam.com>
Greetings,
Rather than run my NT Perl script as a service I'd like to run it using
the NT Scheduler Service (AT service). I want to run the script every 5
minutes but I don't want to have 100+ AT jobs. Since I don't have
another scheduler service available, has anyone ever used Perl to
schedule an AT job? It should be fairly easy but I thought I'd check
and see if anyone has an example that would work before I dig in.
It would go something like this.
1. Perl script starts
2. Perl script does its main function then checks the time and
schedules the same script to run 5 minutes later
3. Perl script ends
4. 5 minutes later the entire process repeats itself.
It sounds really easy but I'm a beginning Perl programmer so if anyone
has already been there and done that I'd be grateful for a code example
I can use.
Thanks
--
Alex Tatistcheff
CRI/The Resource Group, Inc.
Boise, ID
Please remove "nospam" from my email when replying
------------------------------
Date: Tue, 25 Aug 1998 06:29:49 +0900
From: no.unsoliciteds@dead.end.com
Subject: Re: Sigh
Message-Id: <35E1DB4E.97CD06DD@dead.end.com>
Mark-Jason Dominus wrote:
> Last week I was in the middle of an interesting discussion about
> `diff', and I went away to the conference, and when I came back the
> discussion was still going on.
funny a couple of weeks ago there was an enourmously long thread arguing about
why it was pointless/right to flame someone for asking a FAQ, I went away on a
trip, got back a couple of days ago and found there were three new threads
doing exactly the same things.
> Oh, I guess that's not important; what
> is important is that people whould be able to come in and say that
> it's URGENT that they be told how to tell if two strings are the same
> and have fourteen people explain how to use the `eq' operator.
Actually I skip the subject lines like that, and if I happen to open one by
mistake I mark it as read and move onto something more interesting
>Right,
> that's what the group is *really* about. I must have forgot. That's
> why it's called comp.lang.perl.here-let-me-read-you-the-manual.
no it's comp.lang.perl.misc (now if I were a touchy "expert" I would have
flamed you for not reading the FAQ before you posted that erroneous and badly
researched piece of info)
> Excuse me. I'd write more, but I've just received mail about how I
> can MAKE $247,500 A YEAR!!! and now I have to rush off to read it.
> Since you promised to leave, I guess I'll see you in the next life.
oh that's called spam, you probably got it because some bozo looked your post
up on Deja News cos they thought a mass mailing would make you happy
------------------------------
Date: Mon, 24 Aug 1998 21:43:23 GMT
From: duke@co.kittitas.wa.us (Duke)
Subject: Threading/forking simple(?) programs
Message-Id: <35e1dc00.363749133@mars.co.kittitas.wa.us>
I have two programs: foo and bar.
foo reads info from a cdrom (kind of lengthy, but not too bad - about
20 minutes a whack)
bar parses and translates the information into something more usable
(cpu intensive)
I want to write a perl script to link the two together so that foo can
read while bar is processing.
Foo can only write to one hardcoded filename : (
I would need to call foo, when it is finished with the first file,
move the file, then run foo and bar simultaneously (foo on the second
file on CDROM, bar on the first file), when the last foo process has
run, then call bar finally to parse the info of the last file.
This is my first try at something executing non-linearly. I have the
subroutines done to start foo and bar with command-line options to
work on the files they need to, and moving the foo file out of the way
each time. How do I make them agree to work simultaneously and let me
know when they are done each time, and then reap the leftovers and
memory?
Thanks in advance for any help you can offer!
Duke Senter
Network Administrator
Kittitas County, WA
------------------------------
Date: Mon, 24 Aug 1998 17:34:05 -0400
From: "Walter Torres" <walter@tscinternet.com>
Subject: Win32 Q: Reading Outlook 98 files
Message-Id: <ezzlMh6z9GA.112@upnetnews03>
I would like to read my Outlook files via Perl.
I have no idea where to start to look for this type of info.
Anyone know where I can start to research this topic?
Has anyone done this?
Thanks.
Walter
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3528
**************************************