[22358] in Perl-Users-Digest
Perl-Users Digest, Issue: 4579 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 18 09:05:56 2003
Date: Tue, 18 Feb 2003 06:05:08 -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 Tue, 18 Feb 2003 Volume: 10 Number: 4579
Today's topics:
Re: (not 1) and (!1) yield zero length string <sfandino@yahoo.com>
-MCPAN to install older PM <andy@misk.co.uk>
[ANNOUNCE] OpenECG programming contest - sample data an (Philip Lees)
Re: createing a daemon <andy@misk.co.uk>
having perl respond to key presses <tyrannous@o-space.com>
Re: having perl respond to key presses <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: having perl respond to key presses <andy@misk.co.uk>
Re: having perl respond to key presses (Tad McClellan)
Re: Help needed -- HCP distribution curve <ganchrow@nospam.com>
Re: Help needed -- HCP distribution curve <jan@oberon.nl>
Re: Help needed -- HCP distribution curve <jan@oberon.nl>
Re: Help needed -- HCP distribution curve <ganchrow@nospam.com>
Re: Help needed -- HCP distribution curve <ganchrow@nospam.com>
Re: Help needed -- HCP distribution curve <thomaso@best.com>
Re: Malformed UTF-8 character <bernie@fantasyfarm.com>
Re: Newbie Q re form to mail script FormProcessorPro (Jay Tilton)
Re: parsing string with whitespace <mbudash@sonic.net>
Re: parsing string with whitespace <REMOVEsdnCAPS@comcast.net>
Perl & VB without activeperl on Windows?? (Ryan)
Re: Perl & VB without activeperl on Windows?? (Helgi Briem)
Re: PL_defstash and segfault (for geeks only) <pavel@gingerall.cz>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <pne-news-20030218@newton.digitalspace.net>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Tad McClellan)
reading excel spreadsheet with perl (Rory)
Re: reading excel spreadsheet with perl <ubl@schaffhausen.de>
Re: reading excel spreadsheet with perl <rereidy@indra.com>
Re: reading excel spreadsheet with perl <spikey-wan@bigfoot.com>
Re: real time log file <spp@monaco377.com>
use DBI; (g)
Re: use DBI; (Helgi Briem)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 18 Feb 2003 10:24:00 +0000
From: =?ISO-8859-1?Q?Salvador_Fandi=F1o_Garc=EDa?= <sfandino@yahoo.com>
Subject: Re: (not 1) and (!1) yield zero length string
Message-Id: <3E5209C0.2030905@yahoo.com>
Hi
parv wrote:
>>if you are using numbers it is not very consistent because
>>
>> !0 ==> 1 # ok
>> !1 ==> '' # most people would expect 0
>
> Exactly my point and problem: using a test result value like above
> causes unexpected behaviour in calculations.
actually not in calculations but if you print or concatenate to other
string the result, in calculations with numbers it works fine.
Bye,
- Salva
------------------------------
Date: Tue, 18 Feb 2003 10:47:11 +0000
From: Andrew McGregor <andy@misk.co.uk>
Subject: -MCPAN to install older PM
Message-Id: <3E520F2F.1080203@misk.co.uk>
Hi,
Perl 5.6.1
cpan> install Getopt::Std
Running install for module Getopt::Std
Running make for J/JH/JHI/perl-5.8.0.tar.gz
The most recent version "1.03" of the module "Getopt::Std"
comes with the current version of perl (5.8.0).
I'll build that only if you ask for something like
force install Getopt::Std
or
install J/JH/JHI/perl-5.8.0.tar.gz
Running make test
Make had some problems, maybe interrupted? Won't test
Running make install
Make had some problems, maybe interrupted? Won't install
cpan>
How can I force the CPAN/shell program to install an older version of a
Perl module, saving me from upgrading the Perl interpreter?
TIA
Andy
------------------------------
Date: Tue, 18 Feb 2003 09:48:39 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: [ANNOUNCE] OpenECG programming contest - sample data and docs now available
Message-Id: <3e52006f.69455718@news.grnet.gr>
Sample data and documentation for the OpenECG programming contest are
now available through the OpenECG Web portal:
http://www.openecg.net/portal.pl?c_header=Programming%20Contest;selected=Useful%20Information
Prizes total 10,000 Euros.
--
OpenECG Programming contest
http://www.openecg.net
e-mail: contest@openecg.net
------------------------------
Date: Tue, 18 Feb 2003 10:51:29 +0000
From: Andrew McGregor <andy@misk.co.uk>
Subject: Re: createing a daemon
Message-Id: <3E521031.2060501@misk.co.uk>
ryan wrote:
> On Tue, 11 Feb 2003 15:24:51 -0500, Abigail wrote:
>
>
>>ryan (ryan@dctnet.net) wrote on MMMCDLI September MCMXCIII in
>><URL:news:pan.2003.02.11.13.19.09.119902.20427@dctnet.net>: -- Hi, --
>>I was wondering if anyone can point me to some information about --
>> creating a daemon with perl. I want it to run from the init.d and be
>>-- able to use the start|stop|restart options. It will just proccess a
>>-- queue file, so it won't be all that complex. Any help would be
>>greatly -- appreciated. I don't really want to have it run as a cron
>>job, as it -- will not be as robust as I would like it to be. Thanks
>>again.
Hi,
I found Proc::Daemon to be a valuable example when I was writing daemons.
HTH, Andy
------------------------------
Date: Tue, 18 Feb 2003 10:59:45 -0000
From: <tyrannous@o-space.com>
Subject: having perl respond to key presses
Message-Id: <b2t3lr$csn$1@newsg1.svr.pol.co.uk>
How do I get perl to respond to key presses?
for example:
sub loop
{
while (not $something)
{
if (keypress)
{
action
}
}
}
------------------------------
Date: Tue, 18 Feb 2003 11:16:20 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: having perl respond to key presses
Message-Id: <Xns93267C28742B3elhber1lidotechnet@62.89.127.66>
Someone wrote:
> How do I get perl to respond to key presses?
Have a look in the FAQ.
--
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: Tue, 18 Feb 2003 11:33:10 +0000
From: Andrew McGregor <andy@misk.co.uk>
Subject: Re: having perl respond to key presses
Message-Id: <3E5219F6.2030705@misk.co.uk>
tyrannous@o-space.com wrote:
> How do I get perl to respond to key presses?
>
> for example:
>
> sub loop
> {
>
> while (not $something)
> {
>
> if (keypress)
> {
>
> action
>
> }
>
> }
>
> }
>
>
I don't know how to check for the event keypress, but if you just want
to read a single keypress try Term::Screen and getch();
If it is the event you are after then (outside of Perl) maybe you could
map a keypress with a signal?
HTH, Andy
------------------------------
Date: Tue, 18 Feb 2003 07:57:01 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: having perl respond to key presses
Message-Id: <slrnb54etd.2v3.tadmc@magna.augustmail.com>
tyrannous@o-space.com <tyrannous@o-space.com> wrote:
> How do I get perl to respond to key presses?
perldoc -q keyboard
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 18 Feb 2003 06:22:52 GMT
From: "Ganchrow Harris Peck" <ganchrow@nospam.com>
Subject: Re: Help needed -- HCP distribution curve
Message-Id: <0jk4a.28417$Mh3.8574783@twister.nyc.rr.com>
Nick Straguzzi posted to rec.games.bridge:
> Does anyone know where I can find a distribution curve or histogram of
> high-card points in a bridge hand? E.g.: a 10 HCP hand will occur,
> statistically speaking, 11% of the time, a 9 HCP hand is 9%, 8 HCP is
> 7%, etc.
The perl script following my signature should, by way of Monte Carlo
simulation, determine just that. I'm going to let it run overnight and will
post the results in the morning.
The preliminary findings for just over 2,500,000 hands (625,000 trials) are
as follows:
Points Num_Hands Freq
0 9,189 0.3664%
1 19,859 0.7918%
2 33,976 1.3547%
3 61,435 2.4495%
4 96,290 3.8393%
5 129,958 5.1817%
6 164,731 6.5681%
7 202,054 8.0563%
8 222,647 8.8773%
9 234,497 9.3498%
10 235,592 9.3935%
11 224,611 8.9557%
12 201,451 8.0322%
13 173,255 6.9080%
14 142,667 5.6884%
15 110,906 4.4220%
16 83,334 3.3227%
17 59,126 2.3575%
18 40,488 1.6143%
19 25,817 1.0294%
20 16,039 0.6395%
21 9,430 0.3760%
22 5,290 0.2109%
23 2,820 0.1124%
24 1,392 0.0555%
25 692 0.0276%
26 296 0.0118%
27 129 0.0051%
28 40 0.0016%
29 18 0.0007%
30 5 0.0002%
31 1 0.0000%
32 1 0.0000%
33 0 0.0000%
34 0 0.0000%
35 0 0.0000%
36 0 0.0000%
37 0 0.0000%
38 0 0.0000%
39 0 0.0000%
40 0 0.0000%
Total 2,508,036 100.0000%
--
"Nolite te bastardes carborundorum."
To e-mail me directly please change "nospam" in my e-mail address to
"yahoo".
Thanks,
Ganch
#!perl
# Bridge HCP histogram generator
# by Ganchrow Harris Peck, 2/18/2003
# output may be found in the file bridge_histo.txt
# or if timing is a bit off, in bridge_histo_init.txt
use strict;
# constants
my $NUM_CARDS = \52;
my $NUM_HANDS_PER_DEAL = \4;
my $FILE_OUTPUT = \"bridge_histo_init.txt";
my $FILE_LAST_COMPLETE_OUTPUT = \"bridge_histo.txt";
# create the output file
open (OUTFILE, ">$$FILE_OUTPUT") or die "Could not create file
$$FILE_OUTPUT: $!\n";
print OUTFILE ".";
close OUTFILE;
# globals
my $total_hands;
my @num_hands_per_point_total;
while ( $total_hands += $$NUM_HANDS_PER_DEAL) {
my @point_cards_left = (4,4,4,4); # number of cards_left of each point
value
my $cur_hand_num; # the current hand
my @points;
for ( my $cards_left = $$NUM_CARDS; $cards_left > 0; $cards_left-- ) {
my $rand_num = int(rand() * $cards_left ) + 1; # random number between 1
and number of cards remaining
my $other_point_cards_so_far = 0;
foreach my $point_val ( 0 .. $#point_cards_left ) {
if ( $rand_num <= $point_cards_left[$point_val] +
$other_point_cards_so_far ) {
$points[$cur_hand_num] += ( $point_val + 1);
$point_cards_left[$point_val]--;
last;
}
$other_point_cards_so_far += $point_cards_left[$point_val];
}
++$cur_hand_num;
$cur_hand_num %= $$NUM_HANDS_PER_DEAL;
}
foreach ( 0 .. $$NUM_HANDS_PER_DEAL-1 ) {
$num_hands_per_point_total[$points[$_]]++;
}
rename ($$FILE_OUTPUT,$$FILE_LAST_COMPLETE_OUTPUT);
open (OUTFILE, ">$$FILE_OUTPUT");
foreach (0 .. $#num_hands_per_point_total) {
next unless $num_hands_per_point_total[$_]>0;
my $pct_of_total_hands = $num_hands_per_point_total[$_]/$total_hands;
print OUTFILE "$_\t$num_hands_per_point_total[$_]\t$pct_of_total_hands\n";
}
close OUTFILE;
unlink $$FILE_LAST_COMPLETE_OUTPUT;
rename ($$FILE_OUTPUT,$$FILE_LAST_COMPLETE_OUTPUT) or warn "Could not
rename file: $!\n";
}
------------------------------
Date: Tue, 18 Feb 2003 10:32:23 +0100
From: "Jan de Kleijn" <jan@oberon.nl>
Subject: Re: Help needed -- HCP distribution curve
Message-Id: <3e51fc9e$0$49102$e4fe514c@news.xs4all.nl>
"Ganchrow Harris Peck" <ganchrow@nospam.com> wrote in message
news:0jk4a.28417$Mh3.8574783@twister.nyc.rr.com...
> Nick Straguzzi posted to rec.games.bridge:
> > Does anyone know where I can find a distribution curve or histogram of
> > high-card points in a bridge hand? E.g.: a 10 HCP hand will occur,
> > statistically speaking, 11% of the time, a 9 HCP hand is 9%, 8 HCP is
> > 7%, etc.
>
> The perl script following my signature should, by way of Monte Carlo
> simulation, determine just that. I'm going to let it run overnight and
will
> post the results in the morning.
>
(..)
I wrote a similar script several years ago, on two different computers using
different languages. The results showed discrepancies. I found out that the
cause was the random generator- basically the rand() function is a
pseudo-random generator, which is sufficient for eg. visual effects, but
should not be used for statistical analysis.
Maybe this does not apply to the Perl rand() function, but I would not rely
on it.
My solution to that problem was the theoretical approach. I divided all
hands into all possible distributions (13-0-0-0 to 4-3-3-3 and between),
calculated the possibility of each distribution, and, for each distribution,
I calculated the HCP for each suit (13-card: 1 possibility, 10 HCP; 12-card:
13 possibilities, 10(9), 9(1), 8(1), 7(1), 6(1), etc), combined the suits in
the given distribution, then combined the given distributions to a result
like this:
Distribution ! 0 HCP 1 HCP... 10 HCP... 37 HCP
=====================================================
13-0-0-0 ! 0 0 0.0032% 0
12-1-0-0 ! 0 0 0.0062% 0
...
4-3-3-3 ! 0.032% 0.021% ............
The sum of all numbers in this matrix should be 100%. By summing the
columns, you can find out what the chances of a given distribution should
be.
Of course, this was years ago, and now I lost the calculation sheet... ;-(
Regards,
Jan de Kleijn
------------------------------
Date: Tue, 18 Feb 2003 10:42:14 +0100
From: "Jan de Kleijn" <jan@oberon.nl>
Subject: Re: Help needed -- HCP distribution curve
Message-Id: <3e51feec$0$49104$e4fe514c@news.xs4all.nl>
> The sum of all numbers in this matrix should be 100%. By summing the
> columns, you can find out what the chances of a given distribution should
> be.
Typo: "By summing the columns, you can find out what the chance of a given
HCP should be."
Jan
------------------------------
Date: Tue, 18 Feb 2003 11:42:58 GMT
From: "Ganchrow Harris Peck" <ganchrow@nospam.com>
Subject: Re: Help needed -- HCP distribution curve
Message-Id: <6%o4a.28426$Mh3.8665812@twister.nyc.rr.com>
"Ganchrow Harris Peck" <ganchrow@nospam.com> wrote in message
news:0jk4a.28417$Mh3.8574783@twister.nyc.rr.com...
> Nick Straguzzi posted to rec.games.bridge:
> > Does anyone know where I can find a distribution curve or histogram of
> > high-card points in a bridge hand? E.g.: a 10 HCP hand will occur,
> > statistically speaking, 11% of the time, a 9 HCP hand is 9%, 8 HCP is
> > 7%, etc.
>
> The perl script following my signature should, by way of Monte Carlo
> simulation, determine just that. I'm going to let it run overnight and
will
> post the results in the morning.
>
The results of 29,161,336 hands are as follows:
Points Num_Hands Freq
0 106,298 0.3645%
1 230,133 0.7892%
2 395,854 1.3575%
3 717,356 2.4600%
4 1,121,876 3.8471%
5 1,511,436 5.1830%
6 1,912,012 6.5567%
7 2,339,132 8.0213%
8 2,592,874 8.8915%
9 2,728,650 9.3571%
10 2,743,439 9.4078%
11 2,607,565 8.9419%
12 2,341,889 8.0308%
13 2,017,567 6.9186%
14 1,661,630 5.6981%
15 1,289,177 4.4208%
16 964,640 3.3079%
17 688,613 2.3614%
18 468,542 1.6067%
19 301,327 1.0333%
20 186,864 0.6408%
21 110,808 0.3800%
22 61,295 0.2102%
23 32,751 0.1123%
24 16,285 0.0558%
25 7,683 0.0263%
26 3,356 0.0115%
27 1,414 0.0048%
28 563 0.0019%
29 208 0.0007%
30 61 0.0002%
31 26 0.0001%
32 8 0.0000%
33 4 0.0000%
34 0 0.0000%
35 0 0.0000%
36 0 0.0000%
37 0 0.0000%
38 0 0.0000%
39 0 0.0000%
40 0 0.0000%
Total 29,161,336 100.0000%
--
"Nolite te bastardes carborundorum."
To e-mail me directly please change "nospam" in my e-mail address to
"yahoo".
Thanks,
Ganch
------------------------------
Date: Tue, 18 Feb 2003 12:21:13 GMT
From: "Ganchrow Harris Peck" <ganchrow@nospam.com>
Subject: Re: Help needed -- HCP distribution curve
Message-Id: <Zyp4a.28430$Mh3.8677986@twister.nyc.rr.com>
> > Nick Straguzzi posted to rec.games.bridge:
> > > Does anyone know where I can find a distribution curve or histogram of
> > > high-card points in a bridge hand? E.g.: a 10 HCP hand will occur,
> > > statistically speaking, 11% of the time, a 9 HCP hand is 9%, 8 HCP is
> > > 7%, etc.
> >
> > "Ganchrow Harris Peck" replied:
> > The perl script following my signature should, by way of Monte Carlo
> > simulation, determine just that. I'm going to let it run overnight and
> will
> > post the results in the morning.
> >
> "Jan de Kleijn" <jan@oberon.nl> responded:
> I wrote a similar script several years ago, on two different computers
using
> different languages. The results showed discrepancies. I found out that
the
> cause was the random generator- basically the rand() function is a
> pseudo-random generator, which is sufficient for eg. visual effects, but
> should not be used for statistical analysis.
>
> Maybe this does not apply to the Perl rand() function, but I would not
rely
> on it.
The Perl FAQ "Why aren't my random numbers random? " states: "Computers are
good at being predictable and bad at being random (despite appearances
caused by bugs in your programs :-). ... John von Neumann said, 'Anyone who
attempts to generate random numbers by deterministic means is, of course,
living in a state of sin.''
To what degree does this matter for our purposes? I don't rightly know. If
the results obtained by the Perl rand() function (which on my system returns
a fractional number to 15 decimal places greater than or equal to 0 and less
than 1) are either not uniformly distributed (doubtful) or have a systematic
sequencing bias (more likely I would think -- although I don't know for
sure) then the results of this study will not be consistent and are possibly
biased as well.
Neverthless, for what it's worth my results calculated via the Perl rand()
function after 29.2MM trials are rather similar to Wayne's results
(ostensibly calculated precisely from underlying theory) -- all within five
one-thousandths of a percent on an absolute basis for every HCP total and
within about one-half of a percent on a relative basis for HCP totals of 25
or less.
--
"Nolite te bastardes carborundorum."
To e-mail me directly please change "nospam" in my e-mail address to
"yahoo".
Thanks,
Ganch
------------------------------
Date: Tue, 18 Feb 2003 12:34:50 GMT
From: Thomas Andrews <thomaso@best.com>
Subject: Re: Help needed -- HCP distribution curve
Message-Id: <KLp4a.1320$8Z5.21384@sea-read.news.verio.net>
Here's the actual counts and percentages:
HCP Count Pct
0 2310789600 0.363896%
1 5006710800 0.788442%
2 8611542576 1.356119%
3 15636342960 2.462364%
4 24419055136 3.845438%
5 32933031040 5.186193%
6 41619399184 6.554096%
7 50979441968 8.028087%
8 56466608128 8.892189%
9 59413313872 9.356228%
10 59723754816 9.405115%
11 56799933520 8.944680%
12 50971682080 8.026865%
13 43906944752 6.914332%
14 36153374224 5.693323%
15 28090962724 4.423679%
16 21024781756 3.310919%
17 14997082848 2.361695%
18 10192504020 1.605084%
19 6579838440 1.036173%
20 4086538404 0.643536%
21 2399507844 0.377867%
22 1333800036 0.210043%
23 710603628 0.111904%
24 354993864 0.055903%
25 167819892 0.026428%
26 74095248 0.011668%
27 31157940 0.004907%
28 11790760 0.001857%
29 4236588 0.000667%
30 1396068 0.000220%
31 388196 0.000061%
32 109156 0.000017%
33 22360 0.000004%
34 4484 0.000001%
35 624 0.000000%
36 60 0.000000%
37 4 0.000000%
--
Thomas Andrews (thomaso@best.com) http://thomaso.best.vwh.net/
Iraq Reality Check: http://thomaso.best.vwh.net/Iraq.html
Ronald Brownstein writes:
Old question: What did you do in the war, Daddy?
New answer : I pocketed a large tax cut, honey. And then I
passed the bill for the war onto you.
------------------------------
Date: Tue, 18 Feb 2003 06:19:25 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: Malformed UTF-8 character
Message-Id: <CD1A9153A204D03C.0501438ED108C03B.C30948B346276C08@lp.airnews.net>
Benjamin Goldberg <goldbb2@earthlink.net> wrote:
Your summary of UTF-8 problems is fairly disturbing [mostly because
virtually none of the stuff we deal with actually _uses_ UTF-8 and it seems
that that will break a *bunch* of stuff.
} Redhat 8.0 has $ENV{LANG} equal to "en_US.utf8", which perl interprets
} to mean that all text-mode filehandles are utf8.
}
} The way to work around the so-called "problem," is to do the same thing
} you would do to prevent CRLF <=> "\n" conversion on windows. That is:
} binmode() any handle which contains binary data, but leave handles with
} text data alone. And if your source code has strings with their high
} bits set, make sure that the appropriate 'use encoding qw(...)' is done.
UGH!! Would it work just to fix $ENV{LANG}?
} > I've tried "no utf8;" and "use bytes;" in the scripts but the problem
} > seems to be with the modules called.
}
} The "use utf8" pragma has an effect similar to "use encoding qw(utf8);",
} and "no utf8" pragma has an effect similar to "use encoding qw(latin1)".
}
} Using either of "no utf8" or "use encoding qw(latin1)" would solve the
} problems coming from Date/Manip.pm (but you have to put it *in*
} Date/Manip.pm).
Whew... this is pretty unworkable for most of us [I certainly can't go and
edit-by-hand to change bunches of Perl modules to have 'no utf8']. I think
that for many of us, to make all this work we'll probably need some
[relatively simple?] global way to turn off the UTF8 stuff...
} These problems are due to Data/Manip.pm containing strings with
} have thier high-bits set in them -- they are valid ISO-8859-1 strings,
} but they are invalid utf8.
}
} You can correct the problem by adding:
}
} use encoding "latin1";
}
} At the top of Data/Manip.pm. (Well, actually, anywere before sub
} Date_Init_Portuguese should be ok).
Is there a way to "correct" the problem for those of us who have read-only
.pm libraries? It seems bizarre [and certainly feels like something is
broken at a low-level] to have to do 'binmode' on *text* files. [and
that'll make for interesting portability problems: on windows systems you
do 'binmode' on binary files, on "modern" unix systems you have to do
'binmode' on *text* files. Groan...:o)
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Tue, 18 Feb 2003 05:09:07 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Newbie Q re form to mail script FormProcessorPro
Message-Id: <3e51bfde.122712749@news.erols.com>
Trilby <notworking@all.com> wrote:
: I am not a perl programmer but trying to deal with a perl script called
: FormProcessorPro v3.2 [Mitridat.com] which takes the contents of a html
: form and emails it to recipients in a format based on templates that the
: user can set out in a txt file with whatever text is required and the
: fields from the form in brackets [ ].
:
: I am hoping you can help me with a small matter:
Was the program vendor unable or unwilling to help?
------------------------------
Date: Tue, 18 Feb 2003 05:09:29 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: parsing string with whitespace
Message-Id: <mbudash-9E4706.21092917022003@typhoon.sonic.net>
In article <5cf0e3b0.0302172008.67b146a2@posting.google.com>,
thomas_rp@hotmail.com (Thomas Abraham) wrote:
> Hi,
>
> How can I convert the following string:
>
> spacespacespaceHellospacespaceWorld!spacespacespacespace
>
> into an array that contains the following elements
>
> item[0] = spacespacespace
> item[1] = Hello
> item[2] = spacespace
> item[3] = World!
> item[4] = spacespacespacespace
>
> where space stands for whitespace? Please note that I *need* the
> number spaces (not trim it).
>
> Thanks,
>
> -Thomas
$_=" Hello World! ";
my @item = /(\s+|\S+)/g;
print "item[$_] = |$item[$_]|\n" foreach (0..$#item);
yields:
item[0] = | |
item[1] = |Hello|
item[2] = | |
item[3] = |World!|
item[4] = | |
hth-
------------------------------
Date: Tue, 18 Feb 2003 06:13:32 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: parsing string with whitespace
Message-Id: <Xns9326497CB8D99sdn.comcast@216.166.71.239>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
thomas_rp@hotmail.com (Thomas Abraham) wrote in
news:5cf0e3b0.0302172008.67b146a2@posting.google.com:
> Hi,
>
> How can I convert the following string:
>
> spacespacespaceHellospacespaceWorld!spacespacespacespace
>
> into an array that contains the following elements
>
> item[0] = spacespacespace
> item[1] = Hello
> item[2] = spacespace
> item[3] = World!
> item[4] = spacespacespacespace
>
> where space stands for whitespace? Please note that I *need* the
> number spaces (not trim it).
@item = split /(\s+)/, $your_string;
- --
Eric
print scalar reverse sort qw p ekca lre reh
ts uJ p, $/.r, map $_.$", qw e p h tona e;
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13
iD8DBQE+UiNeY96i4h5M0egRAnAVAKDvqSlRiSR2lwvSNM+fHJQY3DSEdwCeKX+z
WOXAJprENdidlvO2hJgo1Ck=
=e/2G
-----END PGP SIGNATURE-----
------------------------------
Date: 18 Feb 2003 05:26:28 -0800
From: scheller@student.umass.edu (Ryan)
Subject: Perl & VB without activeperl on Windows??
Message-Id: <1edcb178.0302180526.20fe9278@posting.google.com>
Here's a question for ya: I wrote a perl program and a vb interface
to it on my solaris box. I made a different version of the perl
script for my windows xp box too which has activeperl on it. Here's
the question, is there something I can do to allow my vb and perl
program to work together on a windows machine without activeperl??!!
Do I jsut need to do it over in C++?? Is there a way to convert or
port it over? Thanks for the ideas.
--Ryan
------------------------------
Date: Tue, 18 Feb 2003 14:04:04 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Perl & VB without activeperl on Windows??
Message-Id: <3e523c11.958152250@news.cis.dfn.de>
On 18 Feb 2003 05:26:28 -0800, scheller@student.umass.edu
(Ryan) wrote:
>Here's a question for ya: I wrote a perl program and a vb interface
>to it on my solaris box.
You did? They have Visual Basic on Solaris?!? Will wonders
never cease?
>I made a different version of the perl
>script for my windows xp box too which has activeperl on it. Here's
>the question, is there something I can do to allow my vb and perl
>program to work together on a windows machine without activeperl??!!
Well, you need perl to run Perl programs. Duh. Which flavour
of install script you run is up to you. Activeperl happens
to be a very good one.
What does "work together" mean? Can you run external
programs in VB? If so, do it like that.
>Do I jsut need to do it over in C++??
Need to, no. You can if you like.
>Is there a way to convert or port it over?
Sure. Hire a programmer who knows Perl and VB.
Have him rewrite it.
--
Regards, Helgi Briem
helgi AT decode DOT is
------------------------------
Date: Tue, 18 Feb 2003 10:30:57 +0100
From: Pavel Hlavnicka <pavel@gingerall.cz>
Subject: Re: PL_defstash and segfault (for geeks only)
Message-Id: <b2sufm$us3$1@ns.felk.cvut.cz>
Ok, thanks, I never tkink about perlporters at the right time :)
Meanwhile we discovered, the problem was in mod_perl code for certain
configurations, Perl is, fortunately, ok.
Thanks for your answer.
Pavel
Benjamin Goldberg wrote:
> Pavel Hlavnicka wrote:
>
>>Hi all,
>>
>>I've met a segmentation fault using mod_perl 1.27, apache 1.3.27 and
>>perl 5.8. Some debugging pointed to the following piece of code (see
>>the whole backtrace at the end)
>
> [snip]
>
> A better place to ask this kind of question would be the perl5porters
> mailing list -- the easiest thing to do would be to use the 'perlbug'
> program which comes with perl to send a bug report. Alternatively, you
> can send an email to <perl5porters@perl.org>. Include everything you've
> included here.
>
------------------------------
Date: Tue, 18 Feb 2003 08:25:18 +0100
From: Philip Newton <pne-news-20030218@newton.digitalspace.net>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.3 $)
Message-Id: <qen35vou9r0j1s3l7gd4hcvd83gil6ja6l@4ax.com>
On Mon, 17 Feb 2003 22:42:48 -0600, tadmc@augustmail.com wrote:
> For more information on choosing a Subject see "Choosing Good
> Subject Lines":
>
> http://www.perl.com/CPAN-local/authors/Dean_Roehrich/subjects.post
Is this a good link to use?
http://www.cpan.org/doc/FAQs/cgi/idiots-guide.html (perhaps not the best
source, but the first I found in a quick search for what I remembered
reading) says
: One more thing: if you see "www.perl.com/CPAN-local" links somewhere,
: please tell the maintainer of that document to fix that to
: "www.cpan.org". For example, "http://www.perl.com/CPAN-local/ports/"
: should be "http://www.cpan.org/ports/". This unfortunate bug spread all
: around the world for quite some time because of perl.com's slightly
: broken redirect feature. www.perl.com never was intended to be the
: definitive CPAN site. www.cpan.org is a load-balancing cluster of more
: than 200 hosts around the globe, www.perl.com/CPAN is just one mirror of
: it. Spread the word.
which would change the link to
http://www.cpan.org/authors/Dean_Roehrich/subjects.post .
However,
http://www.cpan.org/authors/00.Directory.Is.Not.Maintained.Anymore says
further:
: The symbolic links to the long usernames in this directory are an
: historic accident. Please do not use them [...]
: it's stupid to continue to maintain them because every click on this
: directory entry costs a lot of time and with more authors it will
: become more expensive to click on the directory listing. So please do
: not rely on the contents of this directory
:
: *** except for the subdirectory "id". ***
:
: Ignore everything else, expect it to go away in the future.
Which would imply that the best URL (at the moment) is
http://www.cpan.org/authors/id/D/DM/DMR/subjects.post .
I suggest changing the URL in the FAQ.
Respectfully submitted,
Philip Newton
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Tue, 18 Feb 2003 07:56:08 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.3 $)
Message-Id: <slrnb54ero.2v3.tadmc@magna.augustmail.com>
Philip Newton <pne-news-20030218@newton.digitalspace.net> wrote:
> On Mon, 17 Feb 2003 22:42:48 -0600, tadmc@augustmail.com wrote:
>
>> For more information on choosing a Subject see "Choosing Good
>> Subject Lines":
>>
>> http://www.perl.com/CPAN-local/authors/Dean_Roehrich/subjects.post
> Which would imply that the best URL (at the moment) is
> http://www.cpan.org/authors/id/D/DM/DMR/subjects.post .
>
> I suggest changing the URL in the FAQ.
Done.
Thanks Philip.
(but they are "guidelines", not a FAQ :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 18 Feb 2003 00:41:32 -0800
From: rory@vivid-design.com.au (Rory)
Subject: reading excel spreadsheet with perl
Message-Id: <d9ba31e6.0302180041.436fb84f@posting.google.com>
I have an excel spreadsheet on a linux server. I am attempting to use
this spreadsheet as a datasource. It contains information about store
locations (name, state, country ect). I want to update this
spreadsheet as well.
I am using modules Spreadsheet::ParseExcel and
Spreadsheet::WriteExcel.
I am finding it increasingly difficult however to write back to the
spreadsheet with updated/new values ect. This is mainly because
WriteExcel does not have the ability to modify, so i am going through
the entire spreadsheet, rewriting the contents and inserting/removing
values (from a form). (i have not been able to do this successfully as
of yet).
I am not convinced that the method i am following is the most
effecient. Is there a simpler way to do the above. Another module that
allows the modification of an existing spreadsheet perhaps?
Any ideas or input would be appreciated.
------------------------------
Date: Tue, 18 Feb 2003 11:17:22 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: reading excel spreadsheet with perl
Message-Id: <b2t4eq$pr6$1@news.dtag.de>
Rory wrote:
> I am not convinced that the method i am following is the most
> effecient. Is there a simpler way to do the above. Another module that
> allows the modification of an existing spreadsheet perhaps?
>
> Any ideas or input would be appreciated.
Maybe you can use a real database and only import from excel, export to
excel when needed.
What you want to do might not be possible, at least Microsoft Excel
itself does not implement this feature as far as I know.
->malte
------------------------------
Date: Tue, 18 Feb 2003 04:01:05 -0700
From: Ron Reidy <rereidy@indra.com>
Subject: Re: reading excel spreadsheet with perl
Message-Id: <3E521271.9020709@indra.com>
Since you are using the spreadsheet as a database, why not use
DBD::Excel and access it like a database?
--
Ron Reidy
Oracle DBA
Rory wrote:
> I have an excel spreadsheet on a linux server. I am attempting to use
> this spreadsheet as a datasource. It contains information about store
> locations (name, state, country ect). I want to update this
> spreadsheet as well.
>
> I am using modules Spreadsheet::ParseExcel and
> Spreadsheet::WriteExcel.
>
> I am finding it increasingly difficult however to write back to the
> spreadsheet with updated/new values ect. This is mainly because
> WriteExcel does not have the ability to modify, so i am going through
> the entire spreadsheet, rewriting the contents and inserting/removing
> values (from a form). (i have not been able to do this successfully as
> of yet).
>
> I am not convinced that the method i am following is the most
> effecient. Is there a simpler way to do the above. Another module that
> allows the modification of an existing spreadsheet perhaps?
>
> Any ideas or input would be appreciated.
------------------------------
Date: Tue, 18 Feb 2003 13:51:17 -0000
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Re: reading excel spreadsheet with perl
Message-Id: <b2tdqd$bt0$1@newshost.mot.com>
"Rory" <rory@vivid-design.com.au> wrote in message
news:d9ba31e6.0302180041.436fb84f@posting.google.com...
> I have an excel spreadsheet on a linux server. I am attempting to use
> this spreadsheet as a datasource. It contains information about store
> locations (name, state, country ect). I want to update this
> spreadsheet as well.
>
> I am using modules Spreadsheet::ParseExcel and
> Spreadsheet::WriteExcel.
>
> I am finding it increasingly difficult however to write back to the
> spreadsheet with updated/new values ect. This is mainly because
> WriteExcel does not have the ability to modify, so i am going through
> the entire spreadsheet, rewriting the contents and inserting/removing
> values (from a form). (i have not been able to do this successfully as
> of yet).
>
> I am not convinced that the method i am following is the most
> effecient. Is there a simpler way to do the above. Another module that
> allows the modification of an existing spreadsheet perhaps?
>
> Any ideas or input would be appreciated
Have a look at Win32::OLE. This will let you load, modify, and save a
spreadsheet with the same or a different name.
R.
------------------------------
Date: Tue, 18 Feb 2003 11:38:13 +0100
From: =?ISO-8859-15?Q?S=E9bastien?= Cottalorda <spp@monaco377.com>
Subject: Re: real time log file
Message-Id: <3e520f68$0$28281$626a54ce@news.free.fr>
Sébastien Cottalorda wrote:
> I solved the problem.
I've put :
$|=1; # at the begining of my script
and
open (FH....); # after the filehandle creation ...
FH->autoflush(1); # may be it's the same than the first added line
>
>
> Sébastien Cottalorda wrote:
>
>> Hi all,
>>
>> I tried without any success to create a real time log file.
>>
>> My perl program receive the output of the "tail -f /var/log/messages"
>> command.
>> My problem is the following:
>> I cannot manage to write, in real time, in a log file, the output of my
>> program.
>> I use formats (write) and print on the output filehandle.
>> I've even 5 or 6 lines buffered.
>> I've put $|=1 at the beginning of my script but, it doesn't seem to work.
>>
>> platform: perl 5.6.0 on kernel 2.4.2-2
>>
>> If someone as an idea.
>>
>> Thanks in advance.
>>
>> Sébastien
------------------------------
Date: 18 Feb 2003 05:23:57 -0800
From: the_game_is_never_over@yahoo.co.uk (g)
Subject: use DBI;
Message-Id: <2059e247.0302180523.554a8fa2@posting.google.com>
Hi I'm very new to perl so be gentle, have wrote a script to connect
to a mysql database (see below) but I keep getting an error Can't
locate DBI.pm. Other perl non dbi scripts have work, so perl is
installed, does any1 know why this happens (i use perl 5.6)??
$host="dbi:mysql:muisc:localhost";
$dbh = DBI->connect($host,'','')
or die 'unable to connect to database $dbh->errstr\n';
$query = <<END;
select cd_name, artist
from cd
END
$cursor = $dbh->prepare($query);
$cursor->execute
or die 'unable to execute sql command.$dbh->errstr';
my $row;
while ($row= $cursor->fetchrow_arrayref) {-
printf("[%s] [%s]\n", $row->[0],$row->[1]);
}
$cursor->finish;
$dbh->disconnect;
exit(0);
------------------------------
Date: Tue, 18 Feb 2003 13:58:06 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: use DBI;
Message-Id: <3e523a9b.957778142@news.cis.dfn.de>
On 18 Feb 2003 05:23:57 -0800,
the_game_is_never_over@yahoo.co.uk (g) wrote:
>Hi I'm very new to perl so be gentle, have wrote a script to connect
>to a mysql database (see below) but I keep getting an error Can't
>locate DBI.pm. Other perl non dbi scripts have work, so perl is
>installed, does any1 know why this happens (i use perl 5.6)??
This may be a stupid question, but have you installed
mysql itself, the database interface module DBI and
the database driver module DBD::Mysql ?
If not you will need to do that. See
'perldoc -q CPAN' for details or, if running Activestate
Perl, 'perldoc PPM'
Are you sure the database name is "muisc"?
>$host="dbi:mysql:muisc:localhost";
That last exit is completely unnecessary. Where does
it come from? I keep seeing this sort of thing in
cargo cult code.
>exit(0);
--
Regards, Helgi Briem
helgi AT decode DOT is
------------------------------
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.
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 4579
***************************************