[25317] in Perl-Users-Digest
Perl-Users Digest, Issue: 7562 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 23 14:10:54 2004
Date: Thu, 23 Dec 2004 11:10:14 -0800 (PST)
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, 23 Dec 2004 Volume: 10 Number: 7562
Today's topics:
Re: Is zero even or odd? <see@sig.com>
Re: Is zero even or odd? <jmw@jmwa.demon.contraspam.yuk>
Re: Is zero even or odd? <see@sig.com>
Re: Is zero even or odd? <see@sig.com>
Re: Is zero even or odd? <see@sig.com>
Re: Is zero even or odd? <jfields@austininstruments.com>
Re: Is zero even or odd? <see@sig.com>
Re: Is zero even or odd? <jwkenne@attglobal.net>
Re: Is zero even or odd? <torkel@sm.luth.se>
Re: Is zero even or odd? <invalid@msgid.michael.mendelsohn.de>
Re: Is zero even or odd? <invalid@msgid.michael.mendelsohn.de>
Re: Is zero even or odd? <dseaman@no.such.host>
Re: Is zero even or odd? <salesEXTRACT@anasoft.co.uk>
Re: Is zero even or odd? <salesEXTRACT@anasoft.co.uk>
Re: monitor for sleeping processes <jgibson@mail.arc.nasa.gov>
Re: Page can not be displayed... <nobull@mail.com>
Re: Perl interface to Unix ps? chris-usenet@roaima.co.uk
Re: Perl interface to Unix ps? <jgibson@mail.arc.nasa.gov>
Re: Perl vs. .Net regular expressions <matthew.garrish@sympatico.ca>
reformatting linewrapped e-mail messages. <terrylr@blauedonau.com>
Re: reformatting linewrapped e-mail messages. <noreply@gunnar.cc>
Re: return truely random number? <AaronJSherman@gmail.com>
Saving regex to new variable <lance-news@augustmail.com>
Re: Saving regex to new variable <noreply@gunnar.cc>
Re: Saving regex to new variable <nobull@mail.com>
Re: Why does this work? <nobull@mail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 23 Dec 2004 16:18:15 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <bdCyd.11354$Z47.7412@newsread2.news.atl.earthlink.net>
"John Savard" <jsavard@excxn.aNOSPAMb.cdn.invalid> wrote
> So, if 5/0 = ?, then 5 = 0*?. Could ? possibly be positive infinity?
5 / 0 = ?
5 * 1/0 = ?
5 * oo = ?
So ? is equal to 5 infinities added together.
oo, like 0 is neither positive or negative. It can be approached
from + or -. Think of the number line as a circle, or pointing to
the big bang in the night sky.
> What about 0/0 = ?. 0 = 0 * ? is true if ? is any number, positive or
> negative; ? can also be zero. Can we say that ? is any finite number?
Try 1. Works pretty well in my book.
> Also, 0 = -1 * 0.
& oo = -1 * oo
> So, if 5 = 0 * ?, it's also true that 5 = 0 * -1 * ?
"?" isn't a good substitute for and unknown. Statements look like
queries. I'm substituting "x"
> that 5 = 0 * 0 * x.
We part company:
0 * 0 = 0^2
As in
oo * oo = oo^2 = "Aleph 1" in Cantor's book. It is the first oo (Aleph 1)
that can be proven to be larger than ordinary oo (Aleph 0).
Cantor's notation, if extended, would make 0 into "Omega 0", 0^2 "Omega 1".
I think we have the alphas and omegas confused. Or, what the heck:
0 is the end of it all. oo the beginning.
> infinity squared, or infinity cubed, and so on.
> And even that isn't *quite* right, but it comes close.
Look up Cantor.
> If 5 = 0 * ?, then 0 * 0 * ? can be 0 * 5, or it can be 0 * ?, depending
> on which two items you multiply by first.
Ah:
0 * 5 = 0 * 0 * x
= (0 * 0) * x
= 0^2 * x
5 = 0 * x
0 * 5 = 0 * (0 * x)
5 = (0 * x)
5 = 0 * x
If you allow that 0 * 0 == 0^2 the quandary resolves itself.
> This means that 0/0 has to be allowed to be plus or minus infinity as
> well as any finite number, including zero.
In my scheme 0/0 == 1
> Because the rules break down so badly for dividing by zero,
The answer may be new rules. And why not, the alternative is being
stuck in 7th grade in Jr. High School.
> the "real numbers", which are all finite quantities.
But the size of the set of real numbers is Aleph 1 (oo^2). The
integers and reals have values that run to Aleph 0. Finite I
don't think is the word here.
> division by zero is not normally done because it appears
> that it would [not be] fruitful, or produce new, useful results.
I have to agree. I don't find any use for 0^2 myself.
--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer: Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
------------------------------
Date: Thu, 23 Dec 2004 16:14:23 +0000
From: John Woodgate <jmw@jmwa.demon.contraspam.yuk>
Subject: Re: Is zero even or odd?
Message-Id: <MNwG1HHf7uyBFwuV@jmwa.demon.co.uk>
I read in sci.electronics.design that vonroach <hadrainc@earthlink.net>
wrote (in <uupls0hour7vnml8fmjmv89vda8d13i0po@4ax.com>) about 'Is zero
even or odd?', on Thu, 23 Dec 2004:
>Mathematics in general are
>human inventions
That could be the least true statement in this whole thread. A
poikilothermic heptapus from the planet Flig would agree that
exp(pi.i) = i^2, once she understood the notation.
This form of Euler's equation is particularly timely, because this is
the season to get pie-eyed from too many wine-gums and square eyes from
watching too much TV. (;-)
--
Regards, John Woodgate, OOO - Own Opinions Only.
The good news is that nothing is compulsory.
The bad news is that everything is prohibited.
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
------------------------------
Date: Thu, 23 Dec 2004 16:24:30 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <2jCyd.11359$Z47.11216@newsread2.news.atl.earthlink.net>
"John Larkin" <john@spamless.usa> wrote
> Except that in electronic design, especially in realtime embedded
> systems, the issues can't be avoided. If you digitize zero volts, and
> that's the denominator in some process equation, you can't just say
> "oh well, that's not defined/fruitful". Doubly so in a deep embedded
> system where you have no audience to complain to.
Too true.
The response to x/0 is to set the output to it's fail safe value or
freeze it, and optionally sound the alarm and declare the input 'failed'.
0/0 pops up now and then: The system does the right thing if
this is treated as 1.
--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer: Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
------------------------------
Date: Thu, 23 Dec 2004 16:27:26 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <OlCyd.11364$Z47.2041@newsread2.news.atl.earthlink.net>
"Tim Wescott" <tim@wescottnospamdesign.com> wrote
> It is always necessary to ask yourself "why am I allowing a division by
> something that may go to zero?" "What does it mean if my 'x' is zero
> here?", etc., and code accordingly.
Yup. The response is process dependant. Gee, does that mean x/0 must
be what you _need_ it to be? (-it's a joke-).
--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer: Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
------------------------------
Date: Thu, 23 Dec 2004 16:40:31 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <3yCyd.11378$Z47.8077@newsread2.news.atl.earthlink.net>
Kevin Aylward schrieb:
> Not really relevant. Numbers only "exist" in the mind.
Great, now we define what is a number. Bertrand Russel threw
up his hands and whats-his-name declared he can prove it can't
be done.
Numbers, as are what are not just in the head, are 1:1 mappings
to things.
1 apple, 2 apples ... but sqrt(-1)apples, why that's only
in your imagination.
> Points on a plane are often modeled as complex numbers, so you need
> only look as far as graph paper to "see" them.
"Modeled" is the operative word. I see only graph paper,
the rest is imagination = dreams = not really there.
sqrt(-1) is used in calculations to indicate orthogonality,
where never the twain shall meet and the values do not mix
indiscriminately. And never is heard a discouraging word ...
Oklahoma isn't on Usenet, I take it.
Can we settle on "sqrt (-1) is a different kind of number"?
--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer: Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
------------------------------
Date: Thu, 23 Dec 2004 10:43:43 -0600
From: John Fields <jfields@austininstruments.com>
Subject: Re: Is zero even or odd?
Message-Id: <f7tls09r8frmtq908npe68v71amvb3thdr@4ax.com>
On Thu, 23 Dec 04 10:13:35 GMT, jmfbahciv@aol.com wrote:
>In article <x5brcmaylr.fsf@lola.goethe.zz>,
> David Kastrup <dak@gnu.org> wrote:
>>John Fields <jfields@austininstruments.com> writes:
>>
>>> On Wed, 22 Dec 2004 09:31:53 -0800, "Alfred Z. Newmane"
>>> <a.newmane.remove@eastcoastcz.com> wrote:
>>>
>>>
>>>>Try it on a calc for starters. You just can't divide by zero.
>>>
>>> ---
>>> Depends on the calculator.
>>>
>>> I have an _old_ Commodore C8, and if you divide by zero (0.0,
>>> actually) the display will count up.
>
>Are you sure that 0.0 was really 0.000000000?
Sequence of keypesses:
1
divide sign
0
decimal point
0
equal sign.
You figure it out...
--
John Fields
------------------------------
Date: Thu, 23 Dec 2004 16:47:21 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <tECyd.11387$Z47.2931@newsread2.news.atl.earthlink.net>
"Gordon Weast" <gweast@mathworks.com> wrote
> Well, if you move out of pure math into something more applied,
> like physics or signal processing, you find a nice little thing
> called the Dirac delta function. This seems to have confounded
> mathematicians for a while before they finally came around and
> decided that it really does work.
>
> This wonderful function has infinite height and zero width, yet
> it has area 1. Granted, you can work with a limit as the width
> goes to 0, but you don't have to.
>
> Think Fourier series and Fourier analysis. These wouldn't work
> without the Dirac delta function.
>
> A wonderful example of 0 * oo = 1.
Words out of my mouth. Saves me a lot of typing.
> Another is renormalization theory in QED (Quantum Electrodynamics).
> There are several infinities in the theory that appeared to make
> the results nonsense. However, if you keep track very carefully,
> you can get the infinities to cancel and come up with predictions
> that match measurements very accurately.
> This is an example of (oo + n) - oo = n as well as oo/oo = 1.
>
> So all the statements about how these combinations of 0 and oo are
> undefined are only part of the story. Sometimes they do make sense.
OK, so no I am left wordless ... Ha!
> This has been a very entertaining topic. I'll hate to eventually see
> it die... 8-)
Oh, it will go on forever, stuck on a roundabout in information
high street.
--
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer: Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/
------------------------------
Date: Thu, 23 Dec 2004 12:22:02 -0500
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: Is zero even or odd?
Message-Id: <cfDyd.12532$ue4.3369@fe12.lga>
Nicholas O. Lindan wrote:
> But the size of the set of real numbers is Aleph 1 (oo^2).
Aleph-1 is at least aleph-null^aleph-null.
--
John W. Kennedy
"The pathetic hope that the White House will turn a Caligula into a
Marcus Aurelius is as naïve as the fear that ultimate power inevitably
corrupts."
-- James D. Barber (1930-2004).
------------------------------
Date: 23 Dec 2004 18:23:00 +0100
From: Torkel Franzen <torkel@sm.luth.se>
Subject: Re: Is zero even or odd?
Message-Id: <vcbwtv953pn.fsf@beta19.sm.ltu.se>
"John W. Kennedy" <jwkenne@attglobal.net> writes:
> Aleph-1 is at least aleph-null^aleph-null.
On what do you base this assertion?
------------------------------
Date: Thu, 23 Dec 2004 19:15:33 +0100
From: Michael Mendelsohn <invalid@msgid.michael.mendelsohn.de>
Subject: Re: Is zero even or odd?
Message-Id: <41CB0B45.19B34D3F@msgid.michael.mendelsohn.de>
Kevin Aylward schrieb:
> Michael Mendelsohn wrote:
> > Points on a plane are often modelled as complex numbers, so you need
> > only look as far as graph paper to "see" them.
>
> Numbers are concepts. Graph paper drawings are only representaions of
> numbers, not numbers themselves.
>
> How would you go about representing a complex vector "space number"? Now
> we need 9 dimensions for our graph paper.
Have you never heard of origami?
Cheers
Michael
--
Still an attentive ear he lent Her speech hath caused this pain
But could not fathom what she meant Easier I count it to explain
She was not deep, nor eloquent. The jargon of the howling main
-- from Lewis Carroll: The Three Usenet Trolls
------------------------------
Date: Thu, 23 Dec 2004 19:18:24 +0100
From: Michael Mendelsohn <invalid@msgid.michael.mendelsohn.de>
Subject: Re: Is zero even or odd?
Message-Id: <41CB0BEF.F1ADAF0D@msgid.michael.mendelsohn.de>
"Nicholas O. Lindan" schrieb:
> 0/0 pops up now and then: The system does the right thing if
> this is treated as 1.
If in measuring a resistor, we find 0.0A at 0.0V, is the resistance 1
Ohm, then?
Cheers
Michael
--
Still an attentive ear he lent Her speech hath caused this pain
But could not fathom what she meant Easier I count it to explain
She was not deep, nor eloquent. The jargon of the howling main
-- from Lewis Carroll: The Three Usenet Trolls
------------------------------
Date: Thu, 23 Dec 2004 18:10:11 +0000 (UTC)
From: Dave Seaman <dseaman@no.such.host>
Subject: Re: Is zero even or odd?
Message-Id: <cqf1m3$q9k$1@mailhub227.itcs.purdue.edu>
On Thu, 23 Dec 2004 12:22:02 -0500, John W. Kennedy wrote:
> Nicholas O. Lindan wrote:
>> But the size of the set of real numbers is Aleph 1 (oo^2).
> Aleph-1 is at least aleph-null^aleph-null.
No, it's the other way around. Since aleph_1 is by definition the
smallest uncountable cardinal, and since the reals are uncountable, it
follows that c (= 2^aleph_0 = aleph_0^aleph_0), the cardinality of the
continuum, cannot be less than aleph_1. On the other hand, it could be
that c is quite huge among the alephs.
--
Dave Seaman
Judge Yohn's mistakes revealed in Mumia Abu-Jamal ruling.
<http://www.commoncouragepress.com/index.cfm?action=book&bookid=228>
------------------------------
Date: Thu, 23 Dec 2004 19:02:20 GMT
From: "Kevin Aylward" <salesEXTRACT@anasoft.co.uk>
Subject: Re: Is zero even or odd?
Message-Id: <0DEyd.6018$0W6.2671@fe2.news.blueyonder.co.uk>
Dirk Bruere at Neopax wrote:
> Gordon Weast wrote:
>
>>
>> Another is renormalization theory in QED (Quantum Electrodynamics).
>> There are several infinities in the theory that appeared to make
>> the results nonsense. However, if you keep track very carefully,
>> you can get the infinities to cancel and come up with predictions
>> that match measurements very accurately.
>
> And physicists think it an ugly bodge.
Actually, I think the physicists think its just a bit annoying, its the
mathematicians that think its the ugly bodge.
>Clearly the infinities are
> failures of the theory,
Or a failure of the mathematics.
Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
------------------------------
Date: Thu, 23 Dec 2004 19:02:27 GMT
From: "Kevin Aylward" <salesEXTRACT@anasoft.co.uk>
Subject: Re: Is zero even or odd?
Message-Id: <7DEyd.6020$0W6.1520@fe2.news.blueyonder.co.uk>
Nicholas O. Lindan wrote:
> Kevin Aylward schrieb:
>
>> Not really relevant. Numbers only "exist" in the mind.
>
> Great, now we define what is a number. Bertrand Russel threw
> up his hands and whats-his-name declared he can prove it can't
> be done.
>
> Numbers, as are what are not just in the head, are 1:1 mappings
> to things.
>
> 1 apple, 2 apples ... but sqrt(-1)apples, why that's only
> in your imagination.
>
>> Points on a plane are often modeled as complex numbers, so you need
>> only look as far as graph paper to "see" them.
>
> "Modeled" is the operative word. I see only graph paper,
> the rest is imagination = dreams = not really there.
>
> sqrt(-1) is used in calculations to indicate orthogonality,
It can do, but that is not the only reason for sqrt(-1). Its certainly
not how it came about in the first place.
> where never the twain shall meet and the values do not mix
> indiscriminately. And never is heard a discouraging word ...
> Oklahoma isn't on Usenet, I take it.
>
> Can we settle on "sqrt (-1) is a different kind of number"?
No.
Kevin Aylward
salesEXTRACT@anasoft.co.uk
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
------------------------------
Date: Thu, 23 Dec 2004 10:48:24 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: monitor for sleeping processes
Message-Id: <231220041048246794%jgibson@mail.arc.nasa.gov>
In article
<fdbbb3c6ff40597acf79a561b23bc8db@localhost.talkaboutprogramming.com>,
lee_h_shannon <lee_h_shannon@hotmail.com> wrote:
> Hi,
>
> I'm a complete perl newbie... Can anyone assist with a little bit of perl
> to monitor for a process that is constantly sleeping. Once it's decided
> that the process is sleeping, it sends a wee mail! :o)
>
> Any help/pointers would be much appreciated.
What OS are you using? If it is unix, then you can capture, parse, and
check the output of the ps command:
my @status = `ps -af`
using whatever options are appropriate for your flavor of ps. You would
want to check the TIME column at periodic intervals and look for
entries where it is not changing, and the STAT column for entries which
never indicate they are running. This is a relatively crude method, but
it is difficult for one process to find out the status of another
process.
You can also look into Proc modules on CPAN, such as Proc::ProcessTable
and Proc::ProcessTable::Process.
A better approach would be for each process in question to implement a
heartbeat or watchdog type mechanism, such as periodically updating a
file, a database entry, or sending a message of some sort. However, if
you don't have the ability to modify those programs, then you have to
use something less sophisticated.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----
------------------------------
Date: Thu, 23 Dec 2004 18:24:43 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Page can not be displayed...
Message-Id: <cqf27q$10g$1@sun3.bham.ac.uk>
Uri Guttman wrote:
>>>>>>"PL" == Piet L <PietLaroy@hotmail.com> writes:
>
>
> PL> the actual error is: The server can not be found or DNS error
> PL> Internet Explorer
>
> jeez, can't you figure out what that means? it means you can't find the
> server. duh! it has nothing to do with perl, nothing to do with the cgi,
> nothing to do with the server code, nothing to do with your browser.
>
> it probably means you TYPED in the WRONG hostname. but you couldn't have
> figured that out from that error message, could you?
No, Uri, this is Windoze. IE generates the above standard error
whenever any of a large number of possible things goes wrong a bit like
some old BASIC interpreters used to say "Syntax error" even when the
syntax was fine just because they couldn't be bothered to produce a more
helpful error message.
------------------------------
Date: Thu, 23 Dec 2004 17:11:51 +0000
From: chris-usenet@roaima.co.uk
Subject: Re: Perl interface to Unix ps?
Message-Id: <nrar92-4qb.ln1@moldev.cmagroup.co.uk>
J Krugman <jkrugman345@yahbitoo.com> wrote:
> I'm writing a Perl script that is supposed to find the PIDs of all
> the running versions of a program and send them a SIGUSR1. As this
> description suggests, the script is meant for a Unix platform, but
> it could be Linux, BSD, Solaris, etc.
As the risk of upsetting others in clpm, since it's for a *IX platform,
why write this in perl? This will send SIGUSR1 to any process called
"program":
kill -USR1 `ps -e | awk '$NF == "program" {print $1}'`
YMMV depending on which variant of ps you have (i.e. whether you're on
a SysV or BSD derived platform), but then the perl alternatives seem to
struggle with platform dependence, too, as they appear to depend on the
existence of /proc.
Chris
------------------------------
Date: Thu, 23 Dec 2004 10:52:58 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Perl interface to Unix ps?
Message-Id: <231220041052583204%jgibson@mail.arc.nasa.gov>
In article <nrar92-4qb.ln1@moldev.cmagroup.co.uk>,
<chris-usenet@roaima.co.uk> wrote:
> J Krugman <jkrugman345@yahbitoo.com> wrote:
> > I'm writing a Perl script that is supposed to find the PIDs of all
> > the running versions of a program and send them a SIGUSR1. As this
> > description suggests, the script is meant for a Unix platform, but
> > it could be Linux, BSD, Solaris, etc.
>
> As the risk of upsetting others in clpm, since it's for a *IX platform,
> why write this in perl? This will send SIGUSR1 to any process called
> "program":
>
> kill -USR1 `ps -e | awk '$NF == "program" {print $1}'`
>
> YMMV depending on which variant of ps you have (i.e. whether you're on
> a SysV or BSD derived platform), but then the perl alternatives seem to
> struggle with platform dependence, too, as they appear to depend on the
> existence of /proc.
There is also the Unix killall utility:
killall -USR1 programname
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----
------------------------------
Date: Thu, 23 Dec 2004 12:33:19 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Perl vs. .Net regular expressions
Message-Id: <xjDyd.29524$GK5.1517732@news20.bellglobal.com>
<tconti@hotmail.com> wrote in message
news:1103801723.299675.28060@c13g2000cwb.googlegroups.com...
>
> I should have been more explicit when I meant re-compile (my bad...).
> Our code is compiled into executables using ActiveState's PerlApp (v
> 5.0.3). If we upgrade to Perl 5.8 will we need to upgrade the PerlApp
> license or does it include the packages of the locally installed
> version of Perl (i.e. if I have 5.8 installed it will include these
> packages in the executable).
>
Read the docs:
<quote>
PerlApp packages the Perl program with all the required Perl modules and a
modified Perl interpreter into the binary executable. When the executable is
run, it searches for modules within itself before searching the file system.
Building freestanding applications with PerlApp ensures that the executabl
is always executed by the desired version of Perl, even if the target system
is running a different version.
</quote>
Why pay for PerlApp, though, when there are free alternatives for compiling
Perl code into an executable?
http://par.perl.org/index.cgi
Matt
------------------------------
Date: Thu, 23 Dec 2004 12:03:02 -0600
From: "terry l. ridder" <terrylr@blauedonau.com>
Subject: reformatting linewrapped e-mail messages.
Message-Id: <Pine.LNX.4.61.0412231200580.29260@johann.blauedonau.com>
hello;
i am attempting to create a searchable archive of an e-mail list that
i am a member of. i have been able to either use existing perl modules
or write perl scripts to perform most of the message checking and reformatting.
what is giving me problems are the linewrapped replies.
i am searching for a way in perl to reformat the linewrapped replies.
i am already using text::autoformat module to deal with messages where the entire
message is on one long line. text::autoformat does not deal with the below case.
i want to reformat from this:
> > > > Ralph, Chuck: I would absolutely agree with the need to
> > normalize/anneal
> > > > prior to hardening....I neglected to mention that step. I routinely
> do
> > > this
> > > > after forging. I normally use a pyrometer when heat treating, for
> > greater
> > > > uniformity of temperature control and I anneal in preheated
> vermiculite.
> > > >
> > > > The most important aspect of hardening is the efficient
transformation
> > of
> > > > pearlite and ferrite to austenite, which requires proper
> through-heating
> > > of
> > > > the metal at critical temp. The one hour per inch of thickness rule
> > > refers
> > > > to the time spent at critical temp, rather than the total time spent
> > under
> > > > heat. Yes, it really takes that much time for austenitic
> transformation
> > > for
> > > > thick sections. One of the greatest challenges for metallurgists
was
to this:
> > > > Ralph, Chuck: I would absolutely agree with the need to normalize/anneal
> > > > prior to hardening....I neglected to mention that step. I routinely do this
> > > > after forging. I normally use a pyrometer when heat treating, for greater
> > > > uniformity of temperature control and I anneal in preheated vermiculite.
> > > >
> > > > The most important aspect of hardening is the efficient transformation of
> > > > pearlite and ferrite to austenite, which requires proper through-heating of
> > > > the metal at critical temp. The one hour per inch of thickness rule refers
> > > > to the time spent at critical temp, rather than the total time spent under
> > > > heat. Yes, it really takes that much time for austenitic transformation for
> > > > thick sections. One of the greatest challenges for metallurgists was
--
terry l. ridder ><>
------------------------------
Date: Thu, 23 Dec 2004 19:14:08 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: reformatting linewrapped e-mail messages.
Message-Id: <330gt7F3qbdcpU1@individual.net>
terry l. ridder wrote:
> i am attempting to create a searchable archive of an e-mail list that
> i am a member of. i have been able to either use existing perl modules
> or write perl scripts to perform most of the message checking and
> reformatting.
Have you checked out http://www.mhonarc.org/ ?
> what is giving me problems are the linewrapped replies.
> i am searching for a way in perl to reformat the linewrapped replies.
You may want to check out if, and then how, that issue is handled by
MHonArc.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 23 Dec 2004 08:16:02 -0800
From: "ajs@ajs.com" <AaronJSherman@gmail.com>
Subject: Re: return truely random number?
Message-Id: <1103818562.676358.193800@c13g2000cwb.googlegroups.com>
Other posts point out the flaw in your code, but you might also want to
look at Math::TrulyRandom, which I like and use often.
------------------------------
Date: Thu, 23 Dec 2004 12:18:36 -0600
From: Lance Hoffmeyer <lance-news@augustmail.com>
Subject: Saving regex to new variable
Message-Id: <pan.2004.12.23.18.18.35.872153@augustmail.com>
Hello all,
Been a while since I have worked the perl in this manner.
I am trying to save a regex as a new variable "$month".
It is a regex that takes a date (2004-12-23) and saves
only the month from this date. Can't seem to remember
how to do this.
while (my @row_ary = $sth->fetchrow_array)
{
($month) => $row_ary[2] =~ s/([0-9]+)\-([0-9]+)\-([0-9]+)/$2/;
print $month;
}
Lance
------------------------------
Date: Thu, 23 Dec 2004 19:17:47 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Saving regex to new variable
Message-Id: <330h45F3qnomlU1@individual.net>
Lance Hoffmeyer wrote:
> Been a while since I have worked the perl in this manner.
>
> I am trying to save a regex as a new variable "$month".
> It is a regex that takes a date (2004-12-23) and saves
> only the month from this date. Can't seem to remember
> how to do this.
Do you remember how to look up something in the docs?
perldoc perlrequick
perldoc perlretut
perldoc perlre
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 23 Dec 2004 18:49:53 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Saving regex to new variable
Message-Id: <cqf3mv$1mj$1@sun3.bham.ac.uk>
Lance Hoffmeyer wrote:
> Hello all,
>
> Been a while since I have worked the perl in this manner.
>
> I am trying to save a regex as a new variable "$month".
> It is a regex that takes a date (2004-12-23) and saves
> only the month from this date.
What do you mean by the word "saves".
I dont think it is the same as any of the meanings that word as in IT.
When communicaing with others it helps to use words the same meanings as
other people.
I think in your description above "saves" should be read either as
"replaces it with" or "extracts".
> while (my @row_ary = $sth->fetchrow_array)
> {
>
> ($month) => $row_ary[2] =~ s/([0-9]+)\-([0-9]+)\-([0-9]+)/$2/;
> print $month;
> }
What do you think the => operator does? Compare this with what is
actually does (RTFM). Remember to always ask for as much help as
possible. (use strict; use warings;)
You are probably vaguely remembering:
($month = $row_ary[2]) =~ s/([0-9]+)\-([0-9]+)\-([0-9]+)/$2/;
Which is shorthand for:
$month = $row_ary[2];
$month =~ s/([0-9]+)\-([0-9]+)\-([0-9]+)/$2/;
But you should not try to program by rote. It doesn't work in the
longer term. You particularly should not try to program by rote with
only vague recollections. You should program by understanding what you
are doing.
Anyhow you said "new variable". In the above examples $month is not a
new variable, it's a pre-existing one that is overwritten. If you want
to intoduce a new variable you do so with my().
(my $month = $row_ary[2]) =~ s/([0-9]+)\-([0-9]+)\-([0-9]+)/$2/;
However this s/// stuff is all rather affected if all you want in to get
the month.
There is no need to caputre the day and year if you only want the month.
The hyphen in not special in regex outside character classes and does
not need to be escaped.
[0-9] can be abreviated to \d in Perl regex
my ($month) = $row_ary[2] =~ /\d+-(\d+)-\d+/;
Please do not just copy and paste the above without understanding it.
Please RTFM. If there's anything still unclear please ask.
------------------------------
Date: Thu, 23 Dec 2004 18:17:07 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Why does this work?
Message-Id: <cqf1qh$sd$1@sun3.bham.ac.uk>
A. Sinan Unur wrote:
> I have been pulling my hair out trying to remember where this behavior is
> described, but I remember seeing a note somewhere regarding the
> autoquoting of words that start with a dash.
They are not fully autoquoted
$ perl -e"print -shift, 666" foo
-foo666
$ perl -e"print -shift => 666" foo
-shift666
I would consider the behaviour described in this thread to be a
(non-serious) bug in Perl and I would consider any script reliant on
this behaviour to be expoiting a bug in Perl and hense itself broken.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 7562
***************************************