[12341] in Perl-Users-Digest
Perl-Users Digest, Issue: 5941 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 10 03:07:21 1999
Date: Thu, 10 Jun 99 00:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 10 Jun 1999 Volume: 8 Number: 5941
Today's topics:
alt.perl post of the millennium <uri@sysarch.com>
Building modules under solaris <thousel@_no_spam_xnet.com>
Re: cookie-monster.pl, a cookie scrambler. <ocschwar@MIT.EDU>
Re: cookie-monster.pl, a cookie scrambler. (Larry Rosler)
Re: E-mailing with perl is driving me crazy! <lgcl01@es.co.nz>
Re: Get Date in Perl (Lee)
Re: help using large memory from perl perrin@primenet.com
Re: help using large memory from perl <bill@fccj.org>
Re: How do I sort files in a dir by last modified time? (Dean Hudson)
Re: how to connect oracle 8 thru perl on NT <chetan_gautam@hotmail.com>
Re: how to pass a shell command to Perl (Abigail)
Re: mail file with form and cgi-scipt (David Efflandt)
matching function for array? <openlinx@openlinx.net>
Re: matching function for array? (Larry Rosler)
opening a CGI script using IE4.0 from a win98 PWS <duh@pro.com>
Perldoc and Perlfaq <streaking_pyro@my-deja.com>
Re: Perldoc and Perlfaq (Andrew Johnson)
Re: Problems sorting. I'm stupid and I'll die (Larry Rosler)
Re: Regexpr for loop to handle e-address list (Lee)
Re: Rounding excessive trailing decimals (Philip 'Yes, that's my address' Newton)
Re: Sequently adding data to a hash with $x[x..x]??? (Dean Hudson)
strange problem for multithread programming... (GEMINI)
Re: waiting... <outlaw_torn@mailexcite.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Jun 1999 01:30:50 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: alt.perl post of the millennium
Message-Id: <x7iu8w4o6t.fsf@home.sysarch.com>
this person should not be allowed near anything more complicated than a
popup toaster.
we are all going to aohell in a handbasket. i am not charging enough for
my services. does anything really matter?
uri
Subject: Help for the ignorant
Newsgroups: alt.perl
Date: 10 Jun 1999 04:39:38 GMT
Organization: AOL http://www.aol.com
Path: wbnws01.ne.mediaone.net!chnws05.ne.mediaone.net!24.128.1.91!chnws02.mediaone.net!192.148.253.68!netnews.com!news.maxwell.syr.edu!newsfeed.cwix.com!152.163.199.19!portc03.blue.aol.com!audrey03.news.aol.com!not-for-mail
Lines: 18
NNTP-Posting-Host: ladder06.news.aol.com
X-Admin: news@aol.com
Message-ID: <19990610003938.03070.00003010@ng-bg1.aol.com>
Xref: chnws05.ne.mediaone.net alt.perl:2683
Pleas help me, oh holy PERL5 gurus....
I'm going to have data (pure text) on my server that I want to configure a perl
script to go through, and depending upon the data in the file, act accordingly.
1) What format should the source file be in? The information will be in ascii
text, but is there any particular way I should set it up? I mean, what
parameters should I put in the script so that it will do different things
according to the line (or whatever else) in the text file?
That's the bigggest problem.. anyone have any thoughts? Thanks big time.
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 10 Jun 1999 04:40:59 GMT
From: Timothy Housel <thousel@_no_spam_xnet.com>
Subject: Building modules under solaris
Message-Id: <7jnfkr$k0v$1@flood.xnet.com>
Howdy. I'm having a devil of a time building modules under
Solaris 2.7. For example, Net::SSLeay.
I'm using egcs 1.1.2 release as gcc. I've made sure that -B/usr/ccs/bin/
is used so that gnu as/ld are not used. And yet Dynaloader still complains
about unresolved symbols when I do make test. I can see in the library it's
trying to pull in when I do a strings on it (in this case libssl.a and
libcrypto.a). I've tried with and without LD_LIBRARY_PATH set. I've been
looking at dejanews for sometime trying to find a solution, but thus far
have been unsuccessful. Any ideas? Thanks much.
--
Tim Housel
thousel@_no_spam_xnet.com
------------------------------
Date: Thu, 10 Jun 1999 00:21:27 -0400
From: Omri Schwarz <ocschwar@MIT.EDU>
Subject: Re: cookie-monster.pl, a cookie scrambler.
Message-Id: <375F3D47.282794E@MIT.EDU>
To explain the errors:
1. I'm a Perl newbie.
2. This was written in anger and axhaustion.
And 3. When I'm coherent I'll repost the script with corrections
and a copy of the GPL header.
:-)
--
Omri Schwarz ---
Timeless wisdom of biomedical engineering:
"Noise is principally due to the presence of the
patient." -- R.F. Farr
------------------------------
Date: Wed, 9 Jun 1999 20:35:28 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: cookie-monster.pl, a cookie scrambler.
Message-Id: <MPG.11c8d2534606d8c7989ba7@nntp.hpl.hp.com>
In article <1dt5ibh.1q01adbcdgpb2N@p90.tc5.metro.ma.tiac.com> on Wed, 9
Jun 1999 22:45:40 -0400, Ronald J Kimball <rjk@linguist.dartmouth.edu>
says...
...
> > @poschars_hex=("a","b","c","d","e","f","1","2","3",
> > "4","5","6","7","8","9","0");
> > @poschars_b64=("1","2","3","4","5","6","7","8","9","0","=","/",
> > "a","b","c","d","e","f","g","h","i","j","k","l","m",
> > "n","o","p","q","r","s","t","u","v","w","x","y"."z",
...
> Any reason you didn't use the range operator instead?
>
> @poschars_hex=("a" .. "f","1" .. "0");
> @poschars_b64=("1" .. "0", "=", "/", "a" .. "z", "A" .. "Z");
I strongly doubt that that's what you want in the above lines. And I
don't mean the double-quotes where single-quotes would do. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 10 Jun 1999 17:09:30 +1200
From: "Christopher Fairbairn" <lgcl01@es.co.nz>
Subject: Re: E-mailing with perl is driving me crazy!
Message-Id: <928991338.59623@inv.ihug.co.nz>
Hi,
Thank you every one who has responded - a few of you tried my program on
your computers and yes I did recieve email from it.
I still havn't worked out why sendmail won't send email to anyone except
lgcl01@es.co.nz as sendmail doesn't give any errors.
I know the code sample I gave you was sloppy but I was trying to keep it as
short as possible. In my real life program it has error checking as some of
you suggested.
Anyway since I couldn't get sendmail working from my perl program I simply
skipped it and produced a socket based approach which connects to my smtp
server. The program works well now.
I could try poking around to find out why sendmail won't send email but I
don't have the access or time to try. My perl scripts are running on a
webserver via CGI which I only have FTP access to and the ISP isn't too
happy with CGI scripts being run at all.
At home I have three Windows machines - but hopefully I'll get a Linux
machine by the end of the month (this is when my CD is due and I already
have the box ready for the install).
Thanks,
Christopher Fairbairn.
------------------------------
Date: Thu, 10 Jun 1999 01:52:57 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Get Date in Perl
Message-Id: <B384CAF99668208305@0.0.0.0>
In article <x7674y7f9h.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
>.. especially here where i have been
>posting ever since the beginning of usenet in 1934.
1934? Pah! I was posting to usenet in 1917 as part of a secret military
project. But we called it westernunionnet back then.
Lee
------------------------------
Date: Thu, 10 Jun 1999 04:26:23 GMT
From: perrin@primenet.com
Subject: Re: help using large memory from perl
Message-Id: <7jnep8$7qa$1@nnrp1.deja.com>
In article <7jm9vv$et9$3@news.NERO.NET>,
Dan Sugalski <sugalskd@netserve.ous.edu> wrote:
> perrin@primenet.com wrote:
> : I'm having trouble getting perl to use available RAM on a large
Linux
> : machine. The box is a redhat 6.0 machine with 2GB RAM and 1GB swap.
> : I'm loading huge amounts of stuff into hash tables. The problem is,
my
> : program dies with an "out of memory" error at about 560MB. There's
> : plenty of RAM left and it still dies.
>
> : At first I suspected some kind of security measure in Linux was
stopping
> : me, but I was able to go far past 560MB using a little C program
without
> : any problems. Then I tried switching to perl's malloc, and giving
it
> : options for -DPACK_MALLOC and -DTWO_POT_OPTIMIZE, all to no avail.
>
> : Here is a code snippet that exhibits the same problem as my program:
> : perl -e 'for ($i = 0; $i < 9999999; $i++) { $hash{$i}= $i; }'
>
> : Does anyone have any ideas?
>
> What's probably happening is the underlying hash structure's filled
and
> perl's trying to realloc things to make 'em bigger and you're blowing
> available memory on the realloc.
No, I have another 1.5GB of unused physical RAM available.
After digging into this some more, I think I've narrowed it down to a
bug in sbrk() when used with the linux 2.2.x kernel. I tried a simple C
program that attempts to allocate RAM using sbrk(). It dies at ~560MB,
just like my program. I ran this on a machine with only 128MB of RAM
and it died at 940MB (more than the machine actually had).
There's a setting in the kernel source in include/asm-i386/page.h called
PAGE_OFFSET. You have to change this from 0xC0000000 to 0x80000000 to
get linux to recognize the 2GB of RAM. However, the point where sbrk()
dies seems to be directly proportional to this, which makes no sense.
Anyone know if it's possible for Perl to use malloc() instead of
sbrk()? Malloc() doesn't have this problem.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 09 Jun 1999 13:14:35 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: help using large memory from perl
Message-Id: <375ea0c2.0@usenet.fccj.cc.fl.us>
In article <7jkiu6$6qm$1@nnrp1.deja.com>, perrin@primenet.com wrote:
> I'm having trouble getting perl to use available RAM on a large Linux
> machine. The box is a redhat 6.0 machine with 2GB RAM and 1GB swap.
> I'm loading huge amounts of stuff into hash tables. The problem is, my
> program dies with an "out of memory" error at about 560MB. There's
> plenty of RAM left and it still dies.
Did they finally fix that swap space issue with Linux kernel?
Linux doesn't access more than 128MB swap space; defining
more is a waste...
-Sneex- :]
_________________________________________________________________________
Bill Jones | Data Security Specialist | http://www.fccj.org/cgi/mail?dss
FCCJ | 501 W State St | Jacksonville, FL 32202 | 1 (904) 632-3089
$_ = "Jacksonville Perl Monger"; while(/([Jacksonville Perl Monger])/g){
print join(" ", map{defined $_ ? $_ : " "} $`, $&, $', $+), "\n";}
------------------------------
Date: 9 Jun 1999 23:14:12 -0700
From: deanh@nwnet.net (Dean Hudson)
Subject: Re: How do I sort files in a dir by last modified time?
Message-Id: <7jnl3k$4bh@cypress.nwnet.net>
In article <7jnc3j$o1d$1@pumpkin.pangea.ca>, AEF <aef@pangea.ca> wrote:
>How do I sort files in a directory, on the last modified time, and print
>that time out in a formated month, day , year?
>
>Thanks.
>
>
Here's an ugly little beast; it's using the orcish maneuver on $stat[9]
for the files in the directory. $a and $b are switched, since the larger
return values for modtime are the more recent files. Using the orcish
thingy gives access to the values returned by stat so it can feed
them into localtime() via the cache hash.
# ----- code ----- #
#!/usr/bin/perl -w
use strict;
my ( %m );
for ( sort { ( $m{$b} ||= (stat($b))[9] ) <=>
( $m{$a} ||= (stat($a))[9] ) } <*> )
{
my ( $day, $mon, $yr );
( $day, $mon, $yr ) = ( localtime $m{$_} )[3..5];
print "$_ => d:$day m:", $mon + 1, " y:", 1900 + $yr, "\n";
}
# ----- code ----- #
Hope that helps...
dean.
--
--
dean hudson, <deanh@verio.net> Verio Systems Engineering
------------------------------
Date: Thu, 10 Jun 1999 05:10:13 GMT
From: CHETAN <chetan_gautam@hotmail.com>
Subject: Re: how to connect oracle 8 thru perl on NT
Message-Id: <7jnhbh$8ie$1@nnrp1.deja.com>
In article <375e69bf@newsread3.dircon.co.uk>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> CHETAN <chetan_gautam@hotmail.com> wrote:
> >
> >
> > hi everybody,
> >
> > i have an NT server installed on which perl5 and oracle 8 is
installed
> >
> > i want to access oracle database thru perl but cant
> >
>
> I you have a recent Activestate distribution installed -
>
> ppm install DBD-Oracle
>
> /J\
> --
> Jonathan Stowe <jns@gellyfish.com>
>
>
I have worked on the problem and found the location
where the program fails...
it may be failing because of the database name
the program goes like this...
#####################################
use DBI;
$drh = DBI->install_driver('Oracle');
if( !defined $drh ){
die "cannot load driver:$!\n" ;
}
$dbh = $drh->connect( '', 'scott', 'tiger');
die unless $dbh;
#.....my program dies here I want to know how can i know about the
# database name which is to be passed as first argument
# in the connect function... where can i find this.....
$cursor = $dbh->prepare( "SELECT * FROM emp" );
$cursor->execute;
while ( $field = $cursor->fetchrow ) {
print "Field: $field\n";
}
$cursor->finish;
$dbh->disconnect;
#####################################
thanx
CG
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 9 Jun 1999 23:01:33 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: how to pass a shell command to Perl
Message-Id: <slrn7lueld.1h2.abigail@alexandra.delanet.com>
ZENG (zeng@haas.Berkeley.EDU) wrote on MMCVIII September MCMXCIII in
<URL:news:Pine.SOL.4.05.9906091229410.6786-100000@haas.Berkeley.EDU>:
??
?? Then it broke down. Again, the goal is want to have everything after the
?? 'sw' to pass to the Perl. Any suggestions?
That's not a Perl problem. You would do the same as if 'sw' was
a COBOL program, or an ADA program.
How to do what you want can be found in the man page of your shell.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Jun 1999 05:38:15 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: mail file with form and cgi-scipt
Message-Id: <slrn7lujfq.nm.efflandt@efflandt.xnet.com>
On Thu, 10 Jun 1999 02:34:57 +0200, Patrick Enger
<webmaster@vogelfreund.de> wrote:
>Hi,
>
>i have a form with 4 text-fields and 1 file-field.
>
>the script sends me the 4 formfields and stores the .jpg-file on my
>webserver !
>
>how can i get the script to send me the .jpg file by mail ?
CGI.pm and MIME::Lite (Lite.pm). CGI.pm should be on your system, but you
might need to grab MIME::Lite from a CPAN site (see http://www.perl.com/).
>You can see the form on:
>http://www.s3club.de/s3cranking.shtml
>
>
>--
>Liebe Gr|_e
>--
>*************************************************************
> Vogelfreund Internetservice http://www.vogelfreund.de
> Inh. Patrick Enger, Egilbertstr.12, 85354 Freising
> Tel.: 08161-12387, Fax: 08161-12391
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: Wed, 09 Jun 1999 22:01:46 -0700
From: OPENLINX <openlinx@openlinx.net>
Subject: matching function for array?
Message-Id: <375F46BA.93CB5D6A@openlinx.net>
Is there a function that match an element in a given array?
For example, if array X has elements "red", "white", "green", "yellow",
is there any way to find out "red" is in the array X?
Or do I have to loop thru every elements using a loop control structure
like for or while?
Thanks in advance for any help.
------------------------------
Date: Wed, 9 Jun 1999 21:53:28 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: matching function for array?
Message-Id: <MPG.11c8e48b9d0e6298989ba8@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <375F46BA.93CB5D6A@openlinx.net> on Wed, 09 Jun 1999 22:01:46
-0700, OPENLINX <openlinx@openlinx.net> says...
> Is there a function that match an element in a given array?
> For example, if array X has elements "red", "white", "green", "yellow",
>
> is there any way to find out "red" is in the array X?
> Or do I have to loop thru every elements using a loop control structure
> like for or while?
perlfaq4: "How can I tell whether a list or array contains a certain
element?"
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 9 Jun 1999 23:29:35 -0700
From: "duh" <duh@pro.com>
Subject: opening a CGI script using IE4.0 from a win98 PWS
Message-Id: <928996157.334.20@news.remarQ.com>
First CGI script and I can't figure it out!
I have a book describing how to write a CGI script to return data as an html
page it is as follows:
--------------------
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello web surfer";
--------------------
Should put "Hello web surfer" into the web browser, but instead IE4.0 is
prompting for me to either open in in place, or to save the file.
How do I get IE4.0 to just display the text output?
Other notes:
1) deleted the line, my cgi's seem to run fine without it (the path is
defined in windows was my guess)
2) I've messed with settings in PWS (personal web server), setting
read/execute/script settings for the wwwroot as well as cgi-bin directories.
This seems to change my error from "no-read access" to "404 ..." to
"HTTP1.1 500 server error"
3) When I select "open in place" from IE4.0's dialog box when I open the
script, it does run the script in a consol window, it just doesn't return
the data to IE4.0.
4) Is it some type of file association or internal setting for IE4.0?
Help.... Please
Hendrik
------------------------------
Date: Thu, 10 Jun 1999 04:08:36 GMT
From: R.Joseph <streaking_pyro@my-deja.com>
Subject: Perldoc and Perlfaq
Message-Id: <7jndnv$7et$1@nnrp1.deja.com>
I know this may sound stupid but I just got my hands on a copy of
Slackware Linux, and I keep hearing much about "perldoc" and "perlfaq"
and these things. Are these availible in Linux? If so, how would I go
about using them? Any help is great, thanks.
--
R.Joseph
http://www.24-7design.com
http://bowdown.to
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 10 Jun 1999 06:39:35 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Perldoc and Perlfaq
Message-Id: <H4J73.10188$WL.160087@news2.rdc1.on.home.com>
In article <7jndnv$7et$1@nnrp1.deja.com>,
R.Joseph <streaking_pyro@my-deja.com> wrote:
! I know this may sound stupid but I just got my hands on a copy of
! Slackware Linux, and I keep hearing much about "perldoc" and "perlfaq"
! and these things. Are these availible in Linux? If so, how would I go
! about using them? Any help is great, thanks.
They come included with the perl distribution ... if you have
perl you should have perldoc and the documentation.
perldoc is a program to access the doc pages (which are in
POD format) and display all or parts of them on
your console
perlfaq is one of the POD pages; specifically, one that tells
what is in the rest of the perlfaq pages:
perlfaq1 to perlfaq9.
try these at your prompt:
perldoc perldoc (gets perldoc's own documentation)
perldoc perl (overview of perl documentation)
perldoc perltoc (table of contents of documentation)
perldoc perlfaq (overview and toc of faqs)
note: if perl was installed properly, then manpage versions
of all the core documentation is available as well:
man perl
If these don't work, go to www.perl.com/CPAN/src/ and grab the
latest stable distribution (5.005_03 now) and install it (you
may want to do this anyway if the version on your linux system
isn't recent ... type: 'perl -V' for version info).
regards
andrew
------------------------------
Date: Wed, 9 Jun 1999 20:29:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Problems sorting. I'm stupid and I'll die
Message-Id: <MPG.11c8d0de2746b162989ba6@nntp.hpl.hp.com>
In article <1dt5l1m.1rg5jma12nodlgN@p90.tc5.metro.ma.tiac.com> on Wed, 9
Jun 1999 22:45:44 -0400, Ronald J Kimball <rjk@linguist.dartmouth.edu>
says...
...
> perl4 has split() and join(). I bet Larry R. simply forgot the
> parentheses around the arguments, which were not optional until perl5.
Ulp. Right you are. I even showed my try at 'split' (without
parentheses) in a parallel post to yours.
> perl4 also has \U, \L, \u, and \l, but not uc(), lc(), ucfirst() or
> lcfirst(). Go figure.
Yeah. I figured that one out.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 10 Jun 1999 01:18:18 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Regexpr for loop to handle e-address list
Message-Id: <B384C2DA96681E9A9F@0.0.0.0>
In article <375f26d1.38627413@news.flash.net>,
dalehend@flash.net wrote:
>The Backslash acts as a delimiter to assign the quoted list to a
>variable. The variable is for WebBBS.
1) I'm not sure what that sentence is supposed to mean, but it's difficult
to see how a backslash that isn't there can be acting as much of anything.
Try these and see what you get:
print "younme\@work.com shenhim\@work.com" . "\n";
print "younme\\@work.com shenhim\\@work.com" . "\n";
print 'younme\@work.com shenhim\@work.com' . "\n";
2) This ain't Jeopardy, son. The text of your replies should follow the
text of what you're replying to.
>On Wed, 9 Jun 1999 17:27:13 -0700, Tom Phoenix <rootbeer@redcat.com>
>wrote:
>
>>On Thu, 10 Jun 1999 dalehend@flash.net wrote:
>>
>>> Thanks for your feedback Tom. I did look at Mail::Address, but I do
>>> not think it can handle the backslash delimiter that must be present
>>> in each email address as a part of the list.
>>
>>This one?
>>
>>> >> $emaillist = "younme\@work.com shenhim\@work.com";
>>
>>There's no backslash in there. :-) You _could_ have a backslash in a
>>valid address, but I don't think that's what you meant.
Lee
------------------------------
Date: Thu, 10 Jun 1999 06:52:57 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: Rounding excessive trailing decimals
Message-Id: <375f6035.51256392@news.nikoma.de>
On Tue, 08 Jun 1999 23:20:40 -0400, "Anthony Lalande"
<tonyboy@earthling.net> wrote:
>I can't seem to find a way to have PERL return a shortened version of a
>number such as (1.94456543 -> 1.94 or 1.9).
perldoc -q "round function" (if you have a new enough perldoc)
otherwise: perlfaq4 "Does perl have a round function? What about
ceil() and floor()? Trig functions?"
perldoc -f sprintf
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.net>
------------------------------
Date: 9 Jun 1999 21:40:52 -0700
From: deanh@nwnet.net (Dean Hudson)
Subject: Re: Sequently adding data to a hash with $x[x..x]???
Message-Id: <7jnfkk$p03@cypress.nwnet.net>
In article <MPG.11c8b53a682c42c8989ba3@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>In article <7jmrh6$jau@cypress.nwnet.net> on 9 Jun 1999 15:57:42 -0700,
>Dean Hudson <deanh@nwnet.net> says...
>...
>> /^[^,]+,[^,]+/g; # step past 1 & 2
>> while ( /([^,]+),([^,]+)/g ) { # grab a pair
>> $hsh{$1} = $2; # assign to %hsh
>> }
>...
>> Note that it's stepping past the first two values with the first regex
>> and it's using /g to stay in the right spot on each line.
>
>That is somewhat surprising. I thought that every 'm//g' expression had
>its own value for the position iterator. But evidently *identical*
>expressions share an interator, which means they are compiled into
>references to the same pattern. (Though these aren't even identical, in
>that one is anchored and the other isn't, and one captures while the
>other doesn't.)
I think this is because the pos state is reset when m//g fails; in the
example code I posted the first m//g does not fail leaving the /g state
for the next m//g. Here's a modified version and the output:
# ----- code ----- #
#!/usr/bin/perl -w
use strict;
my ( %hsh, $k );
while ( <DATA> ) {
chomp;
/^[^,]+,[^,]+/g;
print "outer => " . pos() . "\n"; # pos info
while ( /([^,]+),([^,]+)/g ) {
$hsh{$1} = $2;
print "inner => " . pos() . "\n"; # pos info
}
}
__END__
1,1,2,2,3,3,4,4,5,5,6,6,7,7
8,8,9,9,10,10,11,11,12,12
13,13,14,14,15,15,16,16,17,17,18,18
# ----- code ----- #
and the output:
deanh@akira:~ > ./posinfo
outer => 3
inner => 7
inner => 11
inner => 15
inner => 19
inner => 23
inner => 27
outer => 3
inner => 7
inner => 13
inner => 19
inner => 25
outer => 5
inner => 11
inner => 17
inner => 23
inner => 29
inner => 35
When you mess with the data so the first regex fails pos is reinitialized
as expected. In our case when the first regex fails your second one does
as well (as you said they match the same string) and there's no data to
stuff into the hash. Regex-erific. :)
>lr@hpl.hp.com
dean.
--
--
dean hudson, <deanh@verio.net> Verio Systems Engineering
------------------------------
Date: 10 Jun 1999 06:00:35 GMT
From: dennis@info4.csie.nctu.edu.tw (GEMINI)
Subject: strange problem for multithread programming...
Message-Id: <7jnka3$aic$1@netnews.csie.NCTU.edu.tw>
I am writing a multithread perl program using Thread module.
However, I often encounter a strange error:
Not a GLOB reference at /usr/local/lib/perl5/5.00502/SelectSaver.pm line 43.
However, I didn't use the SelectSaver module,
and maybe it is invoked by the modules I use:
use Thread;
use Thread::Semaphore;
use IO::Socket;
Another error is "Attempt to free unreferenced scalar....." for the
code:
$nth=new Thread(.....
$nth->detach;
These errornous don't happen for every execution,
but happen so often. So do I have to trace the module to
find out the reason?
------------------------------
Date: Thu, 10 Jun 1999 04:33:26 GMT
From: outlaw_torn <outlaw_torn@mailexcite.com>
Subject: Re: waiting...
Message-Id: <7jnf6m$7tj$1@nnrp1.deja.com>
In article <slrn7lt203.qks.hasant@borg.intern.trabas.co.id>,
hasant@trabas.co.id (Hasanuddin Tamir) wrote:
> fork(), get the child's pid, exec(), send the pid some signal.
> That's basically...
>
Thanks to both for the reply, but what then if I fork...I still have to
wait. The only way I can see to do that is with wait (which from my doco
says that the parent waits...and waits...and waits) or parse the ps
stuff until the child finishes, or kill it when the time is up. What I
basically need is a wait, which gives up waiting when necessary.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5941
**************************************