[25319] in Perl-Users-Digest
Perl-Users Digest, Issue: 7564 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 24 00:05:45 2004
Date: Thu, 23 Dec 2004 21:05:09 -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: 7564
Today's topics:
getting array elements <sam.wun@authtec.com>
Re: getting array elements <noreply@gunnar.cc>
Re: getting array elements <jurgenex@hotmail.com>
Re: How can script find its host's name/IP address? <flavell@ph.gla.ac.uk>
Re: How can script find its host's name/IP address? <matthew.garrish@sympatico.ca>
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? <dseaman@no.such.host>
Re: Is zero even or odd? <jfields@austininstruments.com>
Re: Is zero even or odd? <nowhere@nowhere.net>
Re: Is zero even or odd? (Matthew Russotto)
Line continuation in Perl <david@pdbuchan.com>
Re: Line continuation in Perl <amead@comcast.net>
Re: Line continuation in Perl <jurgenex@hotmail.com>
Merging FrontPage HTML into Perl <apasserby@hushmail.com>
Re: Merging FrontPage HTML into Perl <noreply@gunnar.cc>
Re: Perl interface to Unix ps? <dominix@despamed.com>
Re: perl lacks the n of sh's "shift n" <uri@stemsystems.com>
Re: perl lacks the n of sh's "shift n" <jurgenex@hotmail.com>
Re: reformatting linewrapped e-mail messages. <1usa@llenroc.ude.invalid>
Re: reformatting linewrapped e-mail messages. <a@ry.ca>
Re: reformatting linewrapped e-mail messages. <tadmc@augustmail.com>
Re: return truely random number? <sam.wun@authtec.com>
Re: Use of uninitialized value in split ? <tadmc@augustmail.com>
WWW:Search::Ebay not working? <lance-news@augustmail.com>
Re: WWW:Search::Ebay not working? <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 24 Dec 2004 09:20:30 +0800
From: sam <sam.wun@authtec.com>
Subject: getting array elements
Message-Id: <cqfseh$vqv$1@news.hgc.com.hk>
Hi,
I spent a while to try to get individul element from an array, but
returned nothing. The code I used is:
($transdate,$vendorname,$salesvol,$netsales,$custname,$custcode,
$basename,$prodcode,$salescode,$transtype,$returnreason) = @data;
It might be wrong.
What is the correct syntax for doing that?
Thanks
Sam
------------------------------
Date: Fri, 24 Dec 2004 02:35:59 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: getting array elements
Message-Id: <331a4eF3ocr9jU1@individual.net>
sam wrote:
> I spent a while to try to get individul element from an array, but
> returned nothing. The code I used is:
>
> ($transdate,$vendorname,$salesvol,$netsales,$custname,$custcode,
> $basename,$prodcode,$salescode,$transtype,$returnreason) = @data;
>
> It might be wrong.
No, that code looks correct to me. Assuming that @data includes at least
11 elements, all those scalar variables will be assigned the content of
one element each.
Maybe there is some problem in a part of your program that you didn't
show us?
Please follow the posting guidelines for this group:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 24 Dec 2004 01:40:21 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: getting array elements
Message-Id: <9sKyd.9935$_62.384@trnddc01>
sam wrote:
> Hi,
>
> I spent a while to try to get individul element from an array, but
> returned nothing. The code I used is:
>
> ($transdate,$vendorname,$salesvol,$netsales,$custname,$custcode,
> $basename,$prodcode,$salescode,$transtype,$returnreason) =
> @data;
> It might be wrong.
> What is the correct syntax for doing that?
This is one way to do it and it looks correct to me.
Did you confirm that @data actually contains any data?
jue
------------------------------
Date: Thu, 23 Dec 2004 23:15:53 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: How can script find its host's name/IP address?
Message-Id: <Pine.LNX.4.61.0412232258310.3836@ppepc56.ph.gla.ac.uk>
On Thu, 23 Dec 2004, Matt Garrish wrote:
> However, contrary to the followup reply, there most definitely *is*
> an environment variable *in the cgi environment*
OK, as the thread has drifted to a stealth CGI discussion (regardless
that the original question almost certainly wasn't)...
> to find the hostname.
You're talking about the host where the CGI script is running, rather
than the address of the client or proxy that's making the request,
right?
This of course is nothing specific to Perl. But, for the convenience
of Perl users, FAQ9 refers, and points to the relevant CGI resources.
I'd have to recommend looking them up to get the fuller picture.
You're talking about the SERVER_NAME, I take it?
best-practice CGI spec (draft):
http://cgi-spec.golux.com/draft-coar-cgi-v11-03-clean.html#6.1.15
------------------------------
Date: Thu, 23 Dec 2004 19:57:23 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: How can script find its host's name/IP address?
Message-Id: <PPJyd.18110$Z%3.947490@news20.bellglobal.com>
"Alan J. Flavell" <flavell@ph.gla.ac.uk> wrote in message
news:Pine.LNX.4.61.0412232258310.3836@ppepc56.ph.gla.ac.uk...
> On Thu, 23 Dec 2004, Matt Garrish wrote:
>
>> However, contrary to the followup reply, there most definitely *is*
>> an environment variable *in the cgi environment*
>
> OK, as the thread has drifted to a stealth CGI discussion (regardless
> that the original question almost certainly wasn't)...
>
>> to find the hostname.
>
> You're talking about the host where the CGI script is running, rather
> than the address of the client or proxy that's making the request,
> right?
>
> This of course is nothing specific to Perl. But, for the convenience
> of Perl users, FAQ9 refers, and points to the relevant CGI resources.
> I'd have to recommend looking them up to get the fuller picture.
>
> You're talking about the SERVER_NAME, I take it?
>
That is what started all this. Hence my original reply:
"The same way you'd do it in any other language: read the environment
variables."
And the follow up where I pointed that variable out. The confusion seems to
lie with the fact that I didn't specifically say "cgi environment" the first
time around (for those, like the person who responded, who were not aware of
what I was geting at).
I still look at the sparsity of the original post and see someone who wants
to write a (portable) cgi script that doesn't require knowing the server
it's running on in advance. As I said, if I'm wrong, I'm wrong. I had to
correct the poster who claimed that such a thing does not exist, though.
And I did find it a bit galling that I get told that Perl != CGI when that
was the gist of my original reply, so my apologies to Tad if my response was
a bit blunt.
Matt
------------------------------
Date: Fri, 24 Dec 2004 00:17:14 +0100
From: Michael Mendelsohn <invalid@msgid.michael.mendelsohn.de>
Subject: Re: Is zero even or odd?
Message-Id: <41CB51FA.A67B4375@msgid.michael.mendelsohn.de>
John Fields schrieb:
> On Thu, 23 Dec 2004 22:45:26 +0100, Michael Mendelsohn
> >> "Michael Mendelsohn" <invalid@msgid.michael.mendelsohn.de> wrote
> >> > If in measuring a resistor, we find 0.0A at 0.0V, is the resistance 1
> >> > Ohm, then?
> >When checking it turned out that some thief had actually stolen the
> >resistor where 0V,0A was measured. The circuit was broken, but noone
> >noticed because the voltage was zero.
> In truth, the E in
>
> E
> R = ---
> I
>
> refers to the voltage _across_ the resistor, (a shunt, was it?) which
> you didn't measure. What you measured was the voltage from the low
> side of where the resistor was supposed to be to ground, which gave
> you zero volts which corresponded, also, to zero amps. Had you
> measured the voltage _across_ where the resistor was supposed to be
Well, I did - do you think I'm stupid? ;)
The problem is, the measurement was automatic, and since there was
short-circuit somewhere (presumably in parallel to the supposed
resistor), the voltage was zero across the measurement points even
before the resistor was stolen. The current is of course measured the
proper way.
The software computed resistance by Nick's rules and hence never noticed
anything unusual.
> you would have measured the entire supply voltage minus what was being
> dropped across the load by the current flowing through the meter and
> you would have concluded that by subtracting the meter current that
> you would have had:
>
> E E
> R = --- = --- = oo
> I 0
>
> Which would have been right!
Unless E=0 too, in which case the result is 1 (says Nick).
On a short circuit you can detect no voltage, but you can measure a
current.
E 0
R = --- = --- = 0
I I
This leads to a contradiction when E=I=0.
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: Fri, 24 Dec 2004 00:35:20 +0000 (UTC)
From: Dave Seaman <dseaman@no.such.host>
Subject: Re: Is zero even or odd?
Message-Id: <cqfo88$630$1@mailhub227.itcs.purdue.edu>
On Thu, 23 Dec 2004 20:18:14 +0000, John Woodgate wrote:
> I read in sci.electronics.design that Nicholas O. Lindan <see@sig.com>
> wrote (in <YhFyd.11474$Z47.2358@newsread2.news.atl.earthlink.net>) about
> 'Is zero even or odd?', on Thu, 23 Dec 2004:
>>"Dave Seaman" <dseaman@no.such.host> wrote
>>> On Thu, 23 Dec 2004 12:22:02 -0500, John W. Kennedy wrote:
>>> > 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.
>>
>>I'm lost.
> You need to study the math of infinities. Aleph-null is the smallest
> infinity, and whatever you do to it with finite numbers doesn't change
> it. Many operations with itself, even, don't change it. But raising it
> to its power, {-}o^({-}o), creates a new infinity with different
> properties. Although it's called aleph-one, no-one knows whether it is
> the *next* infinity after aleph-null, or whether there are other
> infinities in between.
> No, I can't say I *understand* it either. The above was written in
> parrot mode.
It's a widespread belief (and one that is unfortunately perpetuated by some
popular expositions) that the cardinality of the reals is aleph_1. Not so.
The cardinality of the reals is 2^aleph_0, which is the same as
aleph_0^aleph_0. This cardinal is called c, for the cardinality of the
continuum. The proposition that c = aleph_1 is called the continuum
hypothesis, and it is known to be independent of the usual axioms of set
theory.
<http://mathworld.wolfram.com/ContinuumHypothesis.html>
--
Dave Seaman
Judge Yohn's mistakes revealed in Mumia Abu-Jamal ruling.
<http://www.commoncouragepress.com/index.cfm?action=book&bookid=228>
------------------------------
Date: Fri, 24 Dec 2004 00:47:51 +0000 (UTC)
From: Dave Seaman <dseaman@no.such.host>
Subject: Re: Is zero even or odd?
Message-Id: <cqfovm$630$2@mailhub227.itcs.purdue.edu>
On Thu, 23 Dec 2004 19:02:20 GMT, Kevin Aylward wrote:
> 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.
No, not at all. It's not a function in the ordinary sense, but a
generalized function. It's a linear functional defined on a certain
function space.
<http://mathworld.wolfram.com/DeltaFunction.html>.
>>Clearly the infinities are
>> failures of the theory,
> Or a failure of the mathematics.
Definitely not.
--
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 18:47:15 -0600
From: John Fields <jfields@austininstruments.com>
Subject: Re: Is zero even or odd?
Message-Id: <l1oms09cfvsmikcnjfib28vtdp3l3v6qsg@4ax.com>
On Fri, 24 Dec 2004 00:17:14 +0100, Michael Mendelsohn
<invalid@msgid.michael.mendelsohn.de> wrote:
>John Fields schrieb:
>> On Thu, 23 Dec 2004 22:45:26 +0100, Michael Mendelsohn
>> >> "Michael Mendelsohn" <invalid@msgid.michael.mendelsohn.de> wrote
>> >> > If in measuring a resistor, we find 0.0A at 0.0V, is the resistance 1
>> >> > Ohm, then?
>
>> >When checking it turned out that some thief had actually stolen the
>> >resistor where 0V,0A was measured. The circuit was broken, but noone
>> >noticed because the voltage was zero.
>
>> In truth, the E in
>>
>> E
>> R = ---
>> I
>>
>> refers to the voltage _across_ the resistor, (a shunt, was it?) which
>> you didn't measure. What you measured was the voltage from the low
>> side of where the resistor was supposed to be to ground, which gave
>> you zero volts which corresponded, also, to zero amps. Had you
>> measured the voltage _across_ where the resistor was supposed to be
>
>Well, I did - do you think I'm stupid? ;)
---
Not so far ;)
---
>The problem is, the measurement was automatic, and since there was
>short-circuit somewhere (presumably in parallel to the supposed
>resistor), the voltage was zero across the measurement points even
>before the resistor was stolen. The current is of course measured the
>proper way.
---
I'm not trying to be insulting, but would you mind explaining how the
current was measured?
---
>The software computed resistance by Nick's rules and hence never noticed
>anything unusual.
---
Nick's rules?
I'm in the dark about that. Clue me in?
---
>> you would have measured the entire supply voltage minus what was being
>> dropped across the load by the current flowing through the meter and
>> you would have concluded that by subtracting the meter current that
>> you would have had:
>>
>> E E
>> R = --- = --- = oo
>> I 0
>>
>> Which would have been right!
>
>Unless E=0 too, in which case the result is 1 (says Nick).
>
>On a short circuit you can detect no voltage, but you can measure a
>current.
>
> E 0
> R = --- = --- = 0
> I I
>
>This leads to a contradiction when E=I=0.
---
So it would seem, but a short across the resistor would still have
resulted in a voltage drop across the resistor equal to the parallel
resistance of the resistor and the short multiplied by the current
through that parallel resistance. Since there's no such thing as a
perfect short and the resistance of the resistor was known beforehand,
the "short" and the anomalous current (which you said you measured)
through it should have pointed to either the resistor failing shorted,
an external short developing across the resistor, or some dirty
bastard stealing the resistor and putting a short across where it was,
no?
How much was that resistor worth, anyway?
--
John Fields
------------------------------
Date: Thu, 23 Dec 2004 20:47:28 -0500
From: "robert j. kolker" <nowhere@nowhere.net>
Subject: Re: Is zero even or odd?
Message-Id: <331apkF3r3tepU4@individual.net>
Dave Seaman wrote:
>
> No, not at all. It's not a function in the ordinary sense, but a
> generalized function. It's a linear functional defined on a certain
> function space.
Here is an analogy. A function is like a vector. A delta "function" is
like a one form.
Bob Kolker
------------------------------
Date: Thu, 23 Dec 2004 22:53:44 -0600
From: russotto@grace.speakeasy.net (Matthew Russotto)
Subject: Re: Is zero even or odd?
Message-Id: <EZOdnaqXBOVFPVbcRVn-hA@speakeasy.net>
In article <It+Hd8BnRPyBFw8A@jmwa.demon.co.uk>,
John Woodgate <noone@yuk.yuk> wrote:
>I read in sci.electronics.design that Matthew Russotto
><russotto@grace.speakeasy.net> wrote (in <RqadnScDqOI5fVXcRVn-
>jg@speakeasy.net>) about 'Is zero even or odd?', on Tue, 21 Dec 2004:
>>But sin (pi*x)/pi*x is
>>discontinous at zero.
>
>Is it? Does the limit of its differential differ as x->0+ and as x->0-?
>If not, it's 'squeezed'.
I'm not sure what you mean by 'squeezed'; it's piecewise continuous.
------------------------------
Date: Thu, 23 Dec 2004 23:36:10 -0500
From: David Buchan <david@pdbuchan.com>
Subject: Line continuation in Perl
Message-Id: <MPG.1c3566c8b84fb80d98969c@news.ca.inter.net>
Hi guys,
This may seem a trivial/dumb question.
In FORTRAN, if a line gets really long (extending past column 72), you
can put a character in column six of the next line and continue.
In C, you use a backslash and then continue on the next line.
In Perl, it seems, you can make a line really really loooonnnng (at
least, Active Perl doesn't complain). But for the sake of readability,
is there a way to have my long expression chopped-up so that it spans
more than one line? Somebody running Perl on AIX said that you just
continue on the next line without any special characters. Active Perl
didn't seem to keen on that. It said something about interpreting it as
a function.
Any body knowledgeable on this admittedly very minor point?
Thanks,
Dave
------------------------------
Date: Thu, 23 Dec 2004 22:54:01 -0600
From: Alan Mead <amead@comcast.net>
Subject: Re: Line continuation in Perl
Message-Id: <pan.2004.12.24.04.54.01.397941@comcast.net>
Star date: Thu, 23 Dec 2004 23:36:10 -0500, David Buchan's log:
> In Perl, it seems, you can make a line really really loooonnnng (at
> least, Active Perl doesn't complain). But for the sake of readability,
> is there a way to have my long expression chopped-up so that it spans
> more than one line? Somebody running Perl on AIX said that you just
> continue on the next line without any special characters. Active Perl
> didn't seem to keen on that. It said something about interpreting it as
> a function.
I agree with the AIX guy. Why don't you post the code that caused
problems. Chances are, you are choosing a poor place to use a newline or,
perhaps even more likely, you have a completely unrelated syntax problem
that you are misperceiving.
-Alan
------------------------------
Date: Fri, 24 Dec 2004 04:54:18 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Line continuation in Perl
Message-Id: <_hNyd.8468$rL3.1014@trnddc03>
David Buchan wrote:
[...]
> In Perl, it seems, you can make a line really really loooonnnng (at
> least, Active Perl doesn't complain). But for the sake of readability,
> is there a way to have my long expression chopped-up so that it spans
> more than one line?
Perl does not care about line breaks (there are a few exceptions).
Any sequence of white space characters (i.e. space, tab, and newline) is
treated the same way in Perl. That means, wherever you would put a plain
space you could just as well put a newline and some additional space
characters or tabs to make a nice indentation. Just see how people format
their code samples here.
The exceptions I mentioned above are the obvious ones: inside of a string,
inside of numbers, identifiers, or keywords, around closing tag of here
documents (which are just a different style of quoting), and the like.
> Somebody running Perl on AIX said that you just
> continue on the next line without any special characters.
That is basically correct.
> Active Perl
> didn't seem to keen on that. It said something about interpreting it
> as a function.
Show us your code (actually a minimal example that demonstrates the problem)
and I'm sure we can help you figure out where you went wrong.
jue
------------------------------
Date: 23 Dec 2004 16:57:26 -0800
From: "Ari Passopolos" <apasserby@hushmail.com>
Subject: Merging FrontPage HTML into Perl
Message-Id: <1103849846.917770.205920@z14g2000cwz.googlegroups.com>
I have a form response developed in FrontPage that I want to cut and
paste into a perl script. I know I have to escape certain characters--*
$ @ ( ) { } [ ]--but that's not my issue.
What bothers me is a bunch of code that begins ' <!--webbot
bot="ImageMap" ' and ends ' <!--webbot bot="ImageMap" endspan
i-checksum="16085" --> '.
All this stuff seems related to graphics on the page. I'm not using
includes or other crap specific to FrontPage. My quandary is that if I
rip the stuff out, the graphics don't display. If I leave it in, Perl
doesn't recognize it. Help!
Ari
------------------------------
Date: Fri, 24 Dec 2004 02:18:25 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Merging FrontPage HTML into Perl
Message-Id: <33192vF3quqrhU1@individual.net>
Ari Passopolos wrote:
> I have a form response
A form *response*? What's that?
> developed in FrontPage that I want to cut and
> paste into a perl script. I know I have to escape certain characters--*
> $ @ ( ) { } [ ]
In which context would you need to escape all those characters?
> --but that's not my issue.
>
> What bothers me is a bunch of code that begins ' <!--webbot
> bot="ImageMap" ' and ends ' <!--webbot bot="ImageMap" endspan
> i-checksum="16085" --> '.
>
> All this stuff seems related to graphics on the page. I'm not using
> includes or other crap specific to FrontPage. My quandary is that if I
> rip the stuff out, the graphics don't display. If I leave it in, Perl
> doesn't recognize it.
Such comment tags are not Perl code, so you cannot reasonably expect
Perl to "recognize" them. If you have them printed to STDOUT from a CGI
script written in Perl, they will certainly be passed to the web server,
and supposedly included in the HTML source code. I have no idea if
that's sufficient for them to serve their intended purpose, though.
Your problem seems to have very little to do with Perl, and
comp.infosystems.www.authoring.cgi is probably a more suitable newsgroup.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 23 Dec 2004 18:58:49 -1000
From: "DominiX" <dominix@despamed.com>
Subject: Re: Perl interface to Unix ps?
Message-Id: <41cba20c$0$940$626a14ce@news.free.fr>
ici même:J Krugman <jkrugman345@yahbitoo.com> a écrit
> 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.
>
...
>
> TIA,
>
> jill
for that purpose I use Proc::ProcessTable;
HTH
-- dominix
------------------------------
Date: Thu, 23 Dec 2004 23:20:33 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: perl lacks the n of sh's "shift n"
Message-Id: <x7acs461q6.fsf@mail.sysarch.com>
>>>>> "DJ" == Dan Jacobson <jidanni@jidanni.org> writes:
DJ> Is it no great loss that perl lacks the n of sh's "shift n"?
DJ> I suppose there are two cases, one where we are sure we can indeed
DJ> shift n times, use for (1..$n){shift @F} I suppose, and one where we are
DJ> worried we will run out of parameters.
you are mistaken.
perldoc -f splice
shift and friends can all be emulated (albeit slower) by splice.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 23 Dec 2004 23:39:50 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: perl lacks the n of sh's "shift n"
Message-Id: <aHIyd.8274$rL3.3557@trnddc03>
Dan Jacobson wrote:
> Is it no great loss that perl lacks the n of sh's "shift n"?
> I suppose there are two cases, one where we are sure we can indeed
> shift n times, [...]
Maybe you missed the splice() function?
jue
------------------------------
Date: 24 Dec 2004 00:54:52 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: reformatting linewrapped e-mail messages.
Message-Id: <Xns95C8CA95FF0E7asu1cornelledu@132.236.56.8>
"terry l. ridder" <terrylr@blauedonau.com> wrote in
news:Pine.LNX.4.61.0412231200580.29260@johann.blauedonau.com:
> i am already using text::autoformat module to deal with messages where
Sorry, never heard of that module.
--
A. Sinan Unur
1usa@llenroc.ude.invalid
(remove '.invalid' and reverse each component for email address)
------------------------------
Date: Thu, 23 Dec 2004 20:49:38 -0600
From: Ryan <a@ry.ca>
Subject: Re: reformatting linewrapped e-mail messages.
Message-Id: <20041223202403.U794@coyote>
terry l. ridder wrote to on Thu, Dec 23rd at 12:03 -0600:
> hello;
Hi Terry,
> [...]
> text::autoformat does not deal with the below case.
Why should it? I wouldn't.
If the text you're trying to format can not be deterministically parsed
or wrapped by humans, how would you tell a computer how to handle it?
If you wanted to, you could play with some heuristics to fudge it a bit,
but incomprehensible and correct quoting is probably better than
comprehensible misquoting.
Your example:
> > > > 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.
You're not going to have much luck in finding a module (or a human) that
handles garbage like this accurately in the general case. At least not
until Mind::Reader is into its first alpha (wave) or two.
Work on that has been slow, though, with the holiday season. And,
reading other people's debug output is enough to drive one mad. But,
don't worry, I know what you're all thinking, and it'll be out soon.
- Ryan
--
Ryan
------------------------------
Date: Thu, 23 Dec 2004 21:56:29 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: reformatting linewrapped e-mail messages.
Message-Id: <slrncsn4rd.2ga.tadmc@magna.augustmail.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> terry l. ridder wrote:
>> Gunnar Hjalmarsson wrote:
>>> terry l. ridder wrote:
>>>> 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.
>>> aldfldksfj söldkf jalskef jölsakdjf öakdf jölsakdj föasldjföaldf
>> abcdef
>>
>> qpwerpqweri åpqwei råpqowei råpoqwie råpoqwieråpoiqweåproiqwåepo
>
> is there really any safe way to tell whether the string 'abcdef' belongs
> to the previos line, or if it's the beginning of the comment on that
> line?
No.
The bad wrapping has made the data into hamburger, the OP wants
to turn it back into steak.
A futile endeavor, I'm afraid it is too late.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 24 Dec 2004 08:28:52 +0800
From: sam <sam.wun@authtec.com>
Subject: Re: return truely random number?
Message-Id: <cqfpdn$u3o$1@news.hgc.com.hk>
Just found one, Crypt::Random depend on /dev/random device, it really
does give random number no matter how fast I generate the number...
Sam.
sam wrote:
> Hi,
>
> I tried Math::Random and Math::Random::MT, but none of them can generate
> turely random number when I executed the following code in a short time
> frame (twice in a second):
>
> #!/usr/bin/perl
>
> #use Math::Random;
> use Math::Random::MT;
>
> $gen = Math::Random::MT->new($seed); # OR... $gen =
> Math::Random::MT->new(@seed);
>
> print $gen->rand(3)."\n";
>
> #$random = random_uniform();
> #$gmt = gmtime();
>
> #print "Random: " . $random . "-" . $gmt . "\n";
>
> I m trying to generate a transaction code for a data base table using
> the format of random-GMT
>
> Another question is how can I generate a gmt time in the format 92783456
> instead of "Thu Dec 23 15:02:08 2004"?
>
> Thanks
> Sam
------------------------------
Date: Thu, 23 Dec 2004 22:09:57 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Use of uninitialized value in split ?
Message-Id: <slrncsn5kl.2ga.tadmc@magna.augustmail.com>
Lance Hoffmeyer <lance-news@augustmail.com> wrote:
> I keep getting
>
> Use of uninitialized value in split at ./birthday.pl line 33.
> Use of uninitialized value in split at ./birthday.pl line 33.
>
> on some of the lines of my WHILE loop. Some of the other
> lines of the WHILE loop work fine.
You get that message when you use the special "undef" value
as if it actually had been assigned a value.
It very often indicates a bug somewhere...
> When running the script below. I did a check outside of the
> WHILE loop to see if the problem would still exist. It does
> not.
I can't imagine what logic you applied to think that that is
relevant. Where the code is does not matter with regard to
using an undef value, the particular value being used is
what matters.
> #!/usr/bin/perl -w
use warnings; # better than -w
use strict;
Please be respectful of the time of the hundreds of people here
by asking for machine-help before resorting to asking for human-help.
> # Check to see if this happens outside DB loop
> ($year, $month, $week, $day) = split(/:/,"-0:4:3:2:0:0:0",4);
Check to see if this happens when split is passed a *literal string*.
In a loop or not has nothing to do with this problem.
You get no warning because you are not using undef here.
> $dbh = DBI->connect ( "dbi:Pg:dbname=foobar", "foobar",
> "foobar"); if ($dbh) {
> print "connected\n";
(something horrid has happened to the formatting of your code...)
> $today = &UnixDate("today","%Y-%m-%d");
^
^
^ why are you using the ampersand there?
> $flag = DateCalc($date1,$date2,1);
> ($year, $month, $week, $day) = split(/:/,$flag,4);
The $flag variable contains undef.
Looks like DateCalc() or its arguments are to blame, but we haven't
been shown the relevant code, so we can't help with debugging it.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 23 Dec 2004 18:57:38 -0600
From: Lance Hoffmeyer <lance-news@augustmail.com>
Subject: WWW:Search::Ebay not working?
Message-Id: <pan.2004.12.24.00.57.38.861773@augustmail.com>
Ebay searching doesn't appear to be worknig anymore.
Is it something in my script or on ebay? Used to
work fine.
use WWW::Search;
my $oSearch = new WWW::Search('Ebay');
my $sQuery = WWW::Search::escape_query("Elton John MFSL");
$oSearch->native_query($sQuery);
while (my $oResult = $oSearch->next_result())
{ print $oResult->title, "\n";
print $oResult->url, "\n";
}
Lance
------------------------------
Date: Thu, 23 Dec 2004 22:12:16 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: WWW:Search::Ebay not working?
Message-Id: <slrncsn5p0.2ga.tadmc@magna.augustmail.com>
Lance Hoffmeyer <lance-news@augustmail.com> wrote:
> Ebay searching doesn't appear to be worknig anymore.
^^^^^^^ ^^^^
What does it do?
What were you expecting it to do differently?
Did you get any messages?
You should provide one or more symptoms if you hope for a diagnosis.
Have you seen the Posting Guidelines that are posted here frequently?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 7564
***************************************