[19439] in Perl-Users-Digest
Perl-Users Digest, Issue: 1634 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 28 06:05:31 2001
Date: Tue, 28 Aug 2001 03:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <998993110-v10-i1634@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 28 Aug 2001 Volume: 10 Number: 1634
Today's topics:
Re: Accessing $a and $b in conjunction with goto &NAME (Anno Siegel)
Re: adding rows in a text file (soumitra bhattacharya)
Re: Avoiding symbolic references. <goldbb2@earthlink.net>
Can't install a DBD::DB2 on AIX (Jens Jespersen)
Re: delete duplicate records (Ilja Tabachniks)
Re: delete duplicate records <goldbb2@earthlink.net>
distributed require statement. <mfrick@chariot.net.au>
Re: distributed require statement. <nowhere@dot.com>
Re: distributed require statement. <mfrick@chariot.net.au>
Re: expired Linux accounts check program in Perl (Abigail)
Re: fwd: Sex or perl? <britne_yspears@hotmail.com>
Re: fwd: Sex or perl? <britne_yspears@hotmail.com>
gtk_entry_set_text (priya)
how do I use the Thread module(in win98)? <no@mail.addr>
Re: how do I use the Thread module(in win98)? <goldbb2@earthlink.net>
Re: how to get character from string one by one? <davidhilseenews@yahoo.com>
Re: how to get character from string one by one? (Yves Orton)
Re: how to get named constants in Perl (Martien Verbruggen)
Re: I need perl for beginners <nials@britain.agilent.com>
Re: is perl an 'interpretative' language? (Martien Verbruggen)
Re: It's to AM for me to think (Abigail)
Java mucks up split (Trewth Seeker)
Re: Keeping files open <tiedje.t@stn-atlas.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Aug 2001 07:42:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Accessing $a and $b in conjunction with goto &NAME
Message-Id: <9mfi0a$47t$1@mamenchi.zrz.TU-Berlin.DE>
According to Ren Maddox <ren@tivoli.com>:
> On 23 Aug 2001, anno4000@lublin.zrz.tu-berlin.de wrote:
>
> > If it is an option, you could forgo the problem and define complete
> > sorting function(s) (expecting and returning a list) in the module.
> >
> > Or don't use $a and $b in your code and require the user to do
> >
> > sort { ipsort( $a, $b) } @list;
> >
> > Since you are using split() in the comparison routine, the overhead
> > shouldn't matter much, but it is an inconvenience for the user.
>
> Or, just define your sort routine with a prototype of ($$) and sort
> will pass $a and $b as arguments. Then your sort routine can just
> operate on @_[0,1], or do a "my($a,$b)=@_;".
Oh, that's good news.
Anno
--
use overload '${}' => sub { \ 'Just '}, '@{}' => sub { [ 'another ']},
'%{}' => sub { { a => 'Perl '}}, '&{}' => sub { sub { print @_, 'hacker'}};
$plop = bless [];
$plop->( $$plop, $plop->[ 0], $plop->{ a});
------------------------------
Date: 28 Aug 2001 01:48:01 -0700
From: soumitra@mailandnews.com (soumitra bhattacharya)
Subject: Re: adding rows in a text file
Message-Id: <72fd0cf4.0108280048.56c40447@posting.google.com>
Thanks John!
But I want a bit modification.
currently it is giving output like
50+ => 19
11-20 => 1157
1 => 12833
2 => 5517
21-30 => 249
5-10 => 3953
3 => 2933
4 => 1955
41-50 => 23
for an input file like
1||12833||2||0||4||233
2||5517||4||0||6||225
3||2933||7||0||6||226
4||1955||8||0||8||238
5||1242||9||1||7||243
6||873||12||1||8||232
7||674||14||1||8||247
8||505||14||2||9||272
9||377||16||2||8||250
10||282||21||3||11||277
11||253||23||3||14||295
12||191||23||3||11||323
13||170||26||3||12||293
14||138||20||3||11||319
15||105||20||3||11||290
16||76||25||2||13||254
17||79||29||5||14||313
18||47||25||4||5||302
19||50||36||5||25||366
20||48||37||6||68||318
21||46||34||6||9||334
22||31||43||8||18||307
23||38||41||6||19||318
24||25||53||10||18||366
25||21||29||5||12||207
26||19||34||6||31||354
27||20||51||7||24||303
28||20||51||9||11||377
29||14||31||6||6||296
30||15||145||15||114||302
41||2||4||5||5||458
42||5||9||21||2||307
43||3||2||2||1||219
45||4||1||19||7||440
46||1||1||8||1||396
47||1||9||0||1
48||2||14||3||2
49||5||1||8||1
................................
what I want is an output like
41-50=> 3||5||8||3
which comes from
41-50=> (23/8)||(41/8)||(66/8)||(20/8)
20/8 = 2.5 so show 3
41/8 = 5.125 so show 5
currently output is only
41-50=> 23
trammell@haqq.hypersloth.invalid (John J. Trammell) wrote in message news:<slrn9ol4i6.hro.trammell@haqq.hypersloth.net>...
> On 27 Aug 2001 05:36:52 -0700, soumitra bhattacharya wrote:
> > i.e.
> > 1||....
> > 2||..
> > 3||..
> > 4||...
> > 5-10||sum of mails read for 5 to 10||sum of mails deleted for5-10||.....
> > 11-20||...
> > 21-30||....
> > 31-40||...
> > 41-50||....
> > 50-whatever is max
> > so in first row will be data for people logged in once,
> > but in row 5-10 will be sum of data in rows 5,6,7,8,9,10 if they exist.
> > similarly for the row named 11-20 will be sum of data in rows 11..20 if they exist.
> > How do I do this.
>
> One way is to use a hash to accumulate the sums:
>
> my %sum;
>
> while (<>)
> {
> my ($index,$data) = split(/\|\|/,$_); # or whatever
> my $key;
> for ($index)
> {
> $_ < 5 && do { $key = $_; last; };
> $_ < 11 && do { $key = "5-10"; last; };
> $_ < 21 && do { $key = "11-20"; last; };
> $_ < 31 && do { $key = "21-30"; last; };
> $_ < 41 && do { $key = "31-40"; last; };
> $_ < 51 && do { $key = "41-50"; last; };
> $key = "50+";
> }
> $sum{$key} += $data;
> }
>
> while (my($k,$v) = each %sum) { print "$k => $v\n" }
>
> I'm sure there are other solutions, but this one isn't terrible. :-)
------------------------------
Date: Tue, 28 Aug 2001 03:53:44 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Avoiding symbolic references.
Message-Id: <3B8B4E08.B7F8BA86@earthlink.net>
Anno Siegel wrote:
>
> According to Benjamin Goldberg <goldbb2@earthlink.net>:
>
> [calculating Euler's number]
>
> > I suppose it doesn't matter much, anyway. Having seen the amount of
> > time it takes to calculate successive significant bits of euler's
> > number, I've given up on calculating it to the log2(256!)
> > significant bits I need to do what I want.
>
> It can't be that bad. Using e = 1 + 1/1! + ... + 1/n!, the error is
> less than twice the first neglected term, so we want n = 256. My
> measly Pentium 90 does that in about 15 seconds.
>
> > It's far easier and faster to download it off of a website.
>
> That may still be true, if you count writing the program.
Umm, this is a different Euler's constant I'm calculating. It's for
implementing something on John Savard's crypo pages.... Here's a quote:
"The constant I am using is Euler's constant, sometimes called the
Euler-Mascheroni constant, also known as gamma. Its value is
.57721 56649 01532 86060 65120 90082..."
I'm not sure why he picked this particular number, given how hard it is
to calculate. I would have picked a number which is known to be
transcendental and which is easy to calculate.
I suppose I should have mentioned I was looking for gamma, not e.
Anyway, the value is calculated as:
gamma = sum( i=1..inf, i*sum( j=2**i..2**(i+1)-1, (-1)**j / j ) );
which takes an ungodly long time to get even a few significant digits.
--
I'm not a programmer but I play one on TV...
------------------------------
Date: 28 Aug 2001 00:37:41 -0700
From: jensjespersen@grundfos.com (Jens Jespersen)
Subject: Can't install a DBD::DB2 on AIX
Message-Id: <581cb966.0108272337.56ddb208@posting.google.com>
Hi
I am trying to compile a DBD::DB2 in to my perl, but no sucess. I got
this
root@elna:/tmp/DBD-DB2-0.75 > make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib
-I/usr/opt/perl5/lib/5.00503/aix -I/usr/opt/perl5/lib/5.00503 -e 'use
Test::Harness qw(&runtests $verbose); $verbose
=0; runtests @ARGV;' t/*.t
t/base..............install_driver(DB2) failed: Can't load
'blib/arch/auto/DBD/DB2/Constants/Constants.so' for module
DBD::DB2::Constants: dlopen: blib/arch/auto/DBD/DB2/Constants
/Constants.so: A file or directory in the path name does not exist. at
/usr/opt/perl5/lib/5.00503/aix/DynaLoader.pm line 169.
at blib/lib/DBD/DB2.pm line 31
BEGIN failed--compilation aborted at blib/lib/DBD/DB2.pm line 31.
Perhaps a required shared library or dll isn't installed where
expected
at t/base.t line 16
dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 4-5
Failed 2/5 tests, 60.00% okay
t/main..............ok
Failed Test Status Wstat Total Fail Failed List of failed
-------------------------------------------------------------------------------
t/base.t 2 512 5 2 40.00% 4-5
Failed 1/2 test scripts, 50.00% okay. 2/6 subtests failed, 66.67%
okay.
make: 1254-004 The error code from the last command is 2.
Stop
All the files it ask for is there, but the make can't find it.
this is my perl setup.
root@elna:/tmp/DBD-DB2-0.75 > perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
Platform:
osname=aix, osvers=4.3.3.0, archname=aix
uname='aix funny 3 4 000001716600 '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O', gccversion=
cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-qmaxmem=16384'
ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-qmaxmem=16384'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
alignbytes=8, usemymalloc=n, prototype=define
Linker and Libraries:
ld='ld', ldflags ='-s'
libpth=/lib /usr/lib /usr/ccs/lib
libs=-lnsl -ldbm -ldl -lld -lm -lc -lcrypt -lbsd -lPW -lC_r
libc=/lib/libc.a, so=a, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-bE:perl.exp'
cccdlflags=' ', lddlflags='-bhalt:4 -bM:SRE
-bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -b noentry -lc'
Characteristics of this binary (from libperl):
Built under aix
Compiled at Aug 14 1999 08:59:55
@INC:
/usr/opt/perl5/lib/5.00503/aix
/usr/opt/perl5/lib/5.00503
/usr/opt/perl5/lib/site_perl/5.005/aix
/usr/opt/perl5/lib/site_perl/5.005
.
root@elna:/tmp/DBD-DB2-0.75 >
I think it is a path missing but which path?
Please help.
Br.
Jens Jespersen
------------------------------
Date: 28 Aug 2001 00:33:32 -0700
From: billy@arnis-bsl.com (Ilja Tabachniks)
Subject: Re: delete duplicate records
Message-Id: <5d4a715a.0108272333.3875f3a7@posting.google.com>
Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:<3B8AF695.7720E00C@earthlink.net>...
> Charles Cowdrick wrote:
> >
> > I'm trying to delete duplicate records in a flatfile.
> > I searched Google under "delete duplicate records" and the Camel book,
> > to no avail.
> > Here's my code. I know that line 4 is weird, but I don't know how else
> > to compare the current record with the next record.
> > #!perl
> >
> > RECORD: while (<DATA>) {
> > next RECORD if $_ eq $_[$_++];
> > print "$_\n";
> > }
>
> You can't compare the current to the *next*, only to the previous.
>
> my $previous;
> while( <DATA> ) {
> next if $_ eq $previous && defined $previous;
> print;
> $previous = $_;
> }
>
<skipped...>
IMHO you should _first_ check if defined $previous
and only then (if true) check if $_ eq $ previous:
...
next if defined $previous && $_ eq $previous;
...
Otherwise you'll get a "Use of uninitialized value in string eq ..."
when checking the first line of data.
Ilja.
------------------------------
Date: Tue, 28 Aug 2001 05:35:46 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: delete duplicate records
Message-Id: <3B8B65F2.11E88F56@earthlink.net>
Ilja Tabachniks wrote:
>
> Benjamin Goldberg wrote:
> > Charles Cowdrick wrote:
> > >
> > > I'm trying to delete duplicate records in a flatfile.
> > > I searched Google under "delete duplicate records" and the Camel
> > > book, to no avail.
> > > Here's my code. I know that line 4 is weird, but I don't know how
> > > else to compare the current record with the next record.
> > > #!perl
> > >
> > > RECORD: while (<DATA>) {
> > > next RECORD if $_ eq $_[$_++];
> > > print "$_\n";
> > > }
> >
> > You can't compare the current to the *next*, only to the previous.
> >
> > my $previous;
> > while( <DATA> ) {
> > next if $_ eq $previous && defined $previous;
> > print;
> > $previous = $_;
> > }
> >
>
> <skipped...>
>
> IMHO you should _first_ check if defined $previous
> and only then (if true) check if $_ eq $ previous:
> ...
> next if defined $previous && $_ eq $previous;
> ...
>
> Otherwise you'll get a "Use of uninitialized value in string eq ..."
> when checking the first line of data.
I naively thought that in an "&&" statement, one should [for efficiency]
put statements which will be true more often after statements which will
be true less often. Since the defined will usually be true, it would be
more efficient to put after the eq, which usually won't be true.
You are, of course, completely correct for the reason you mentioned.
--
I'm not a programmer but I play one on TV...
------------------------------
Date: Tue, 28 Aug 2001 11:51:10 +0930
From: "Matthew Frick" <mfrick@chariot.net.au>
Subject: distributed require statement.
Message-Id: <3b8aff56$1_3@news.chariot.net.au>
I want to require a script that is housed on another server anyone off the
top of there head know how to do this??
ie require "whatever.domain.com ....and the folder on that server";
#dunno what the format is??
hope this makes sense.
--
___________________________________________________________
- l e a r n . e d s o l u t i o n s p t y l t d -
Matthew Frick Systems Administrator / Programmer
www.learnedsolutions.com mfrick@learnedsolutions.com
Level 1, 214 Greenhill Road, EASTWOOD, South Australia 5063
Phone: +61 8 8272 3111 (Ext. 643) Fax: +61 8 8272 3211
___________________________________________________________
E-mail Disclaimer:
http://www.learnedsolutions.com/disclaimer.html
___________________________________________________________
------------------------------
Date: Tue, 28 Aug 2001 16:30:20 +1000
From: "Gregory Toomey" <nowhere@dot.com>
Subject: Re: distributed require statement.
Message-Id: <tQGi7.5307$Nd2.85632@newsfeeds.bigpond.com>
"Matthew Frick" <mfrick@chariot.net.au> wrote in message
news:3b8aff56$1_3@news.chariot.net.au...
> I want to require a script that is housed on another server anyone off the
> top of there head know how to do this??
>
> ie require "whatever.domain.com ....and the folder on that server";
> #dunno what the format is??
>
> hope this makes sense.
>
G' day Matthew.
The 'require' command uses a file name on the operating system you are
using, not a URL. Possible solutionss are:
1: Use the LPW::Simple module to copy the source code to the local machine
whenever it changes on the remote machine
2. Mount the remote file system locally using NFS
gtoomey
------------------------------
Date: Tue, 28 Aug 2001 16:20:57 +0930
From: "Matthew Frick" <mfrick@chariot.net.au>
Subject: Re: distributed require statement.
Message-Id: <3b8b3ee4$1_2@news.chariot.net.au>
Ok. for your future reference you can not do it with a require :(
you need something like.............
###################################################################
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 ".$ua->agent);
$req = new HTTP::Request('GET', 'http://www.perl.org'); #accept pointed to
your perl script to run that script and
#return any html stuff
$result = $ua->request($req);
if ($result->is_success()) {
print $result->content;
}else {
print "Personalised Error: " . $result->code
. " " . $result->message;
}
###################################################################
"Matthew Frick" <mfrick@chariot.net.au> wrote in message
news:3b8aff56$1_3@news.chariot.net.au...
> I want to require a script that is housed on another server anyone off the
> top of there head know how to do this??
>
> ie require "whatever.domain.com ....and the folder on that server";
> #dunno what the format is??
>
> hope this makes sense.
>
>
> --
> ___________________________________________________________
> - l e a r n . e d s o l u t i o n s p t y l t d -
>
> Matthew Frick Systems Administrator /
Programmer
> www.learnedsolutions.com mfrick@learnedsolutions.com
>
> Level 1, 214 Greenhill Road, EASTWOOD, South Australia 5063
> Phone: +61 8 8272 3111 (Ext. 643) Fax: +61 8 8272 3211
> ___________________________________________________________
> E-mail Disclaimer:
> http://www.learnedsolutions.com/disclaimer.html
> ___________________________________________________________
>
>
>
------------------------------
Date: 28 Aug 2001 06:35:41 GMT
From: abigail@foad.org (Abigail)
Subject: Re: expired Linux accounts check program in Perl
Message-Id: <slrn9omeu2.r1r.abigail@alexandra.xs4all.nl>
Valentin 30IR976 (radiotito@yahoo.com) wrote on MMCMXVII September
MCMXCIII in <URL:news:3B8934A4.4BAB2F80@yahoo.com>:
() I am writing a Perl program to check my Linux system with shadow
() password installed. I think I must check the /etc/shadow file, with
() something like:
()
() ($field1,$field2,...)=split(..) -->extract the different fields from
() shadow file with ':' as separator.
()
() But, I think I should make some calculus to check if an account has
() expired, but...what calculus?
I just thought that in class yesterday. But that was Solaris System
Administration, so I guess you don't want to hear it. Nor does this
seem a Perl question to me.
Why don't you go read your systems manual pages?
Abigail
--
perl -wle 'print prototype sub "Just another Perl Hacker" {};'
# A songbird in a
# she-oak tree. A dove flying
# above a tea house.
------------------------------
Date: Tue, 28 Aug 2001 08:14:08 +0100
From: "Listy" <britne_yspears@hotmail.com>
Subject: Re: fwd: Sex or perl?
Message-Id: <awHi7.314535$Do6.14289690@nnrp4.clara.net>
"Little Pussy" <bemsha@midsouthSPAM.rr.com> wrote in message
news:MPG.15f494d3947d4537989885@news-server.midsouth.rr.com...
> In the Ancient Tome of " <Pine.LNX.4.21.0108271444490.12574-100000
> @bdslppp62.spkn.uswest.net> ", Brian A. Stumm The Feeble said...
>
> > On Mon, 27 Aug 2001, Little Pussy wrote:
> >
> > > In the Ancient Tome of " <slrn9olq0v.jqr.trammell@haqq.hypersloth.net> ",
> > > John J. Trammell The Feeble said...
> > >
> > > > On Mon, 27 Aug 2001 12:50:40 -0700, Brian A. Stumm <bs@bs-linux.com> wrote:
> > > > > I'm the Brain. I do everything right...
> > > >
> > > > +10 points for pro-GNU .sig
> > > > -10000 points for 18-line .sig
> > > >
> > > > http://www.math.fu-berlin.de/~guckes/afw/
> > > >
> > >
> > > Yeah! Brain is so thoughtless!
> > >
> > >
> > Well then that's -11,666.66* points for you Bemsha.
> >
> > *mathematical equation based on the fact that 18 line sig equals negative
> > 10,000 points.
> >
>
> Oh yeah? Well, that was another -10,000 for you!
Can I have some points?
--
Listener[AsS]
I fear going anywhere near the one called "Listy" - Bemsha of AGHLTFC
------------------------------
Date: Tue, 28 Aug 2001 08:16:53 +0100
From: "Listy" <britne_yspears@hotmail.com>
Subject: Re: fwd: Sex or perl?
Message-Id: <MyHi7.314536$Do6.14290027@nnrp4.clara.net>
"Brian Stumm" <bs@bs-linux.com> wrote in message news:3B8AD90C.31F7CEB8@bs-linux.com...
>
>
> Little Pussy wrote:
>
> > In the Ancient Tome of " <Pine.LNX.4.21.0108271403520.12296-100000
> > @bdslppp62.spkn.uswest.net> ", Brian A. Stumm The Feeble said...
> >
> > > On 27 Aug 2001, John J. Trammell wrote:
> > >
> > > > On Mon, 27 Aug 2001 12:50:40 -0700, Brian A. Stumm <bs@bs-linux.com> wrote:
> > > > > I'm the Brain. I do everything right...
> > > >
> > > > +10 points for pro-GNU .sig
> > > > -10000 points for 18-line .sig
> > > >
> > > > http://www.math.fu-berlin.de/~guckes/afw/
> > > >
> > > >
> > > Ah thanks, you know it's my goal in life to have the largest number of
> > > negative points. I'm currently at 21,890,136 and growing...
> > >
> >
> > /awards Brain +33,456,239 'That's-A-Fuck-Load-of-Points' points
>
> me evil plan is a success.
>
> Muahahahahahahahahaha
>
/awards Brain -11566103 "Get-Your-Balance-Back-To-Zero" points
/runs off giggling.
--
Listener[AsS]
I fear going anywhere near the one called "Listy" - Bemsha of AGHLTFC
------------------------------
Date: 28 Aug 2001 02:41:22 -0700
From: sivanipriya@hotmail.com (priya)
Subject: gtk_entry_set_text
Message-Id: <503cd7ca.0108280141.21d76a9a@posting.google.com>
v5=lookup_widget(GTKWIDGET(clientwindow),"vbox5");
entry_text=lookup_widget(GTKWIDGET(V5),"entry2");
gtk_entry_set_text(GTK_ENTRY(entry_text),user.GetSurname().c_string());
Is the above code snippet right. I need to pass user.GetSurname().c_string()
inside gtk text entry . The name of the entry is entry2. This entry2 is within
vbox5 which is within the clientwindow.
If I run the gnome crashes.I have ceated the gui using the gtk.
If I could get your help I will be very useful for me.
------------------------------
Date: Tue, 28 Aug 2001 15:00:18 +0800
From: MMX166+2.1G HD <no@mail.addr>
Subject: how do I use the Thread module(in win98)?
Message-Id: <mvcmotonjvp22pjiqjomta76vcungauda0@4ax.com>
my os is win98, and this my perl's version:
>This is perl, v5.6.1 built for MSWin32-x86-multi-thread
when I'm going to use the Thread module, it says:
>This perl was built for "ithreads", which currently does not support Thread.pm.
what is this "ithreads"? it does neither a module name nor a FAQ
keyword.
------------------------------
Date: Tue, 28 Aug 2001 05:38:33 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: how do I use the Thread module(in win98)?
Message-Id: <3B8B6699.77DD90E0@earthlink.net>
MMX166+2.1G HD wrote:
>
> my os is win98, and this my perl's version:
> >This is perl, v5.6.1 built for MSWin32-x86-multi-thread
>
> when I'm going to use the Thread module, it says:
> >This perl was built for "ithreads", which currently does not support > >Thread.pm.
>
> what is this "ithreads"? it does neither a module name nor a FAQ
> keyword.
This is just a guess, but it probably means that it was built in a way
such that some sort of native threading will be used to simulate fork().
Probably, "ithreads" is the name of the native threading package [by
package, I mean collection of .c and/or .dll files, not .pm files]
--
I'm not a programmer but I play one on TV...
------------------------------
Date: Tue, 28 Aug 2001 04:19:35 GMT
From: "David Hilsee" <davidhilseenews@yahoo.com>
Subject: Re: how to get character from string one by one?
Message-Id: <rZEi7.27798$hT4.7647935@news1.rdc1.md.home.com>
"cheng huang" <cheng@cs.wustl.edu> wrote in message
news:9mf2tu$q18$1@newsreader.wustl.edu...
> Instead of using substr(), can sb. give a better solution? Thanks.
>
> -- Cheng
I guess you're looking for something like split?
$text = "my string";
foreach $letter (split "", $text)
{
print "\"$letter\"\n";
}
--
David Hilsee
------------------------------
Date: 28 Aug 2001 02:39:14 -0700
From: demerphq@hotmail.com (Yves Orton)
Subject: Re: how to get character from string one by one?
Message-Id: <74f348f7.0108280139.332a852a@posting.google.com>
"David Hilsee" <davidhilseenews@yahoo.com> wrote in message news:<rZEi7.27798$hT4.7647935@news1.rdc1.md.home.com>...
> "cheng huang" <cheng@cs.wustl.edu> wrote in message
> news:9mf2tu$q18$1@newsreader.wustl.edu...
> > Instead of using substr(), can sb. give a better solution? Thanks.
> >
> > -- Cheng
>
> I guess you're looking for something like split?
>
> $text = "my string";
>
> foreach $letter (split "", $text)
> {
> print "\"$letter\"\n";
> }
I will be posting an overview of a bunch of benchmarks that I have
done in this area to the thread 'one character at a time'. There are
a variety of methods (5 basic ideas) to achieve it ranging from fast
to slow. Split doesnt perform that well actually.
Yves
------------------------------
Date: Tue, 28 Aug 2001 18:26:16 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: how to get named constants in Perl
Message-Id: <slrn9omld8.3ga.mgjv@martien.heliotrope.home>
On 27 Aug 2001 22:56:42 GMT,
Abigail <abigail@foad.org> wrote:
> Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMCMXVI September
> MCMXCIII in <URL:news:slrn9of5ja.3ga.mgjv@martien.heliotrope.home>:
> ## On 25 Aug 2001 04:52:44 -0700,
> ## Joachim Ziegler <ziegler@algorilla.de> wrote:
> ## > i've seen the following line of code for defining a contant scalar
> ## > equal to pi:
> ## >
> ## > *PI=\3.141592;
> ## I'd certainly not recommend this.
> ##
> ## > is this the preferred way in Perl to do something like "const double
> ## > PI=3.1415;" in C?
> ##
> ## No. The preferred way, nowadays, would be to use the const pragma:
> ##
> ## use const PI => 3.141592;
>
> That would be 'use constant'.
Indeed. I've been programming too much C lately, even though that const
has nothing to do with the pragma constant.
> ## or rather, to get a bit more precision:
> ##
> ## use const PI => 4 * atan2(1, 1);
>
> You know, the short sighteness of Perl programmers keeps amazing me.
Unfortunately, I don't nearly write enough Perl, nowadays. Somehow, that
categorisation just doesn't fit. Call me short-sighted if you want, but
don't do it because I happen to program in Perl.
> Both are useful in there own right, and claiming that one is prefered
> over the other shows a failure to understand the benefits of the other.
>
> With *PI = \3.141592, one can do easy interpolation. With 'use constant',
> you can't. You'd have to use something like "@{[PI]}", which is quite
> horrid.
You are right. If you need to interpolate the constant in a string, then
using a subroutine approach isn't great. However, in code where you
don't need to interpolate, I find that the subroutine methods stand out
much more as being clearly constants:
use constant PI => 3.1415;
$diameter = 2 * PI * $radius;
vs.
our $PI; # 'cuz we do like to run under strict
*PI = \3.1415;
$diameter = 2 * $PI * $radius;
$PI just looks too much like a variable. I find the inconvenience of not
being able to interpolate in a string directly a price I'm willing to
pay for having the constant look like one.
> I really dislike posts that say "I don't recommend this" and "the
> preferred way of doing is", without actually giving any arguments why
> one doesn't recommend something and why something else is preferred. Such
> posts aren't really useful.
Sure.
Martien
--
Martien Verbruggen | Since light travels faster than
Interactive Media Division | sound, isn't that why some people
Commercial Dynamics Pty. Ltd. | appear bright until you hear them
NSW, Australia | speak?
------------------------------
Date: Tue, 28 Aug 2001 09:07:57 +0100
From: Nial Stewart <nials@britain.agilent.com>
Subject: Re: I need perl for beginners
Message-Id: <3B8B515D.58D2EA69@britain.agilent.com>
Online Perspectives wrote:
>
> Hello, I need a basic, beginners site for pearl. Can some one recommend
> one.
>
I have found
http://www.netcat.co.uk/rob/perl/win32perltut.html
to be useful, I'm a newbie too.
Nial.
------------------------------
Date: Tue, 28 Aug 2001 04:17:24 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: is perl an 'interpretative' language?
Message-Id: <slrn9om6qk.7cl.mgjv@verbruggen.comdyn.com.au>
On Tue, 28 Aug 2001 03:55:50 GMT,
John W. Krahn <krahnj@acm.org> wrote:
> John Lin wrote:
>>
>> can be equivalent to this Pascal program:
>>
>> var i,j : integer;
>> for i = 1 to 9
>> for j = 1 to 9
>> writeln(i,' x ',j,' = ',i*j);
program foo;
var i, j : integer;
begin
for i := 1 to 9 do
for j := 1 to 9 do
writeln(i, ' x ', j, ' = ', i * j)
end.
>> and equivelent to this C program:
>>
>> #include <stdio.h>
>
> #include <stdlib.h>
>
>> void main() {
>
> int main( void ) {
Indeed! No nasal daemons allowed.
>:-)
> John
:)
Martien
--
Martien Verbruggen |
Interactive Media Division | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 28 Aug 2001 06:22:13 GMT
From: abigail@foad.org (Abigail)
Subject: Re: It's to AM for me to think
Message-Id: <slrn9ome4q.r1r.abigail@alexandra.xs4all.nl>
Ilmari Karonen (iltzu@sci.invalid) wrote on MMCMXIX September MCMXCIII in
<URL:news:998962555.11327@itz.pp.sci.fi>:
-- In article <9me1e0$c5n$1@mamenchi.zrz.TU-Berlin.DE>, Anno Siegel wrote:
-- >
-- >That could only happen if the overhead of "shift @array" vs. "$array[ 0]"
-- >is greater than one round through the loop. I was betting that it isn't
-- >(and still do), but you're right to point it out.
--
-- Besides, it could well be that shift() is actually faster than fetching
-- an array element by index. No, I'm not going to benchmark it right now.
It could. The point is that we don't know, so the claim that the
optimization "comes for free" is unfounded.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
# A pair of ducks fly.
# A raven flies over the
# pool. A sitting bear.
------------------------------
Date: 28 Aug 2001 01:02:32 -0700
From: trewth_seeker@yahoo.com (Trewth Seeker)
Subject: Java mucks up split
Message-Id: <d690a633.0108280002.6054b2b5@posting.google.com>
Those Java folks at Sun seem to have trouble getting it right, even
when it's already been done for them. They've added regexps and
"split" to Java 1.4, but the split doc
http://java.sun.com/j2se/1.4/docs/api/java/util/regex/Pattern.html
says
The input "boo:and:foo", for example, yields the following results
with these parameters:
Regex Limit Result
: 2 { "boo", "and" }
That's just dumb, and misses the whole point of the limit. This is
going to lead to confusion and cause some people to think that Perl is
just as broken, since Java's split is taken from Perl. What can be
done to get Sun to do it right?
------------------------------
Date: Tue, 28 Aug 2001 08:48:23 +0200
From: "Th. Tiedje" <tiedje.t@stn-atlas.de>
Subject: Re: Keeping files open
Message-Id: <9mfern$os1@dsit03.atlas.de>
"Craig Berry" <cberry@cinenet.net> schrieb im Newsbeitrag
news:Xns910AAC4CE5815cberrycinenetnet1@207.126.101.92...
> etienne@hci.ucsd.edu (Etienne Pelaprat) wrote in
> news:90ee5f8d.0108271542.74ef6508@posting.google.com:
> > I would like to write a perl script which constantly reads from
> > /var/log/maillog, but I'm having trouble figuring out how I can open
> > it up and not have it close when it reaches the end of the file.
> > Instead, when it reaches the end, I want it to wait until a new line
> > gets entered into /var/log/maillog which I can then parse. Basically,
> > how do I write a perl script that does what the command $> tail -f
> > /var/log/maillog does?
>
> I'm rather confused...you knew about the unix tail utility, you have the
> perl doc, this has all the telltale signs of being a FAQ, yet you didn't
> check the FAQ before asking? The simple command 'perldoc -q tail' would
> have got you an exhaustive, authoratative answer to your question
thousands
> of times faster than posting to Usenet and waiting for answers of unknown
> value.
>
> Just out of curiosity, for the benefit of the community in better tuning
> furture help efforts: Why didn't you check the FAQ before posting?
>
> --
> Craig Berry <http://www.cinenet.net/~cberry/>
> "That which is now known, was once only imagined." - William Blake
>
In addition to the FAQ you might want to look
at the "Perl Cookbook" by Tom Christiansen & Nathan
Torkington.
Chapter 8.5 is about "Trailing a Growing File", which
looks to me as the thing you are searching.
Regards,
Thomas
------------------------------
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 1634
***************************************