[13399] in Perl-Users-Digest
Perl-Users Digest, Issue: 809 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 15 18:07:28 1999
Date: Wed, 15 Sep 1999 15:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 15 Sep 1999 Volume: 9 Number: 809
Today's topics:
Re: "POW: domain error" ??? (Colin Keith)
Re: Abigail, Abigail, wherefore art thou, Abigail? a.k. <meowing@banet.net>
Re: Are threads the way to go? Design Advice (Ilya Zakharevich)
Re: Auto-responce email attachments <gellyfish@gellyfish.com>
Re: CGI Hosting? <gellyfish@gellyfish.com>
Re: cookbook: nonforker <SternSZ@gmx.de>
Re: Could someone break this down for me? <aqumsieh@matrox.com>
Re: HELP PARSE EMAIL ADDRESSES PLEASE (Larry Rosler)
Re: HELP PARSE EMAIL ADDRESSES PLEASE <madebeer@igc.apc.org>
Re: Help! Need to check <gellyfish@gellyfish.com>
Re: Hot, Fun S.F Startup Seeks a Gaggle of Perl People <gellyfish@gellyfish.com>
Re: is this object a child of this class? buddachile@yahoo.com
Kerberos? <tflynn@iastate.edu>
Re: lwp-mirror <gisle@aas.no>
Re: message passing in socket comm. <carvdawg@patriot.net>
newbie can't figure out a RE <daleksiuk@home.com>
Re: Parsing Tab Delimited File (Larry Rosler)
Re: Parsing Tab Delimited File <hardpack@my-deja.com>
Re: Parsing Tab Delimited File <tchrist@mox.perl.com>
Re: Parsing Tab Delimited File (Larry Rosler)
Re: Parsing Tab Delimited File (Larry Rosler)
passing "=" as an argument to CGI <stampede3@yourcompass.com>
Re: passing "=" as an argument to CGI <gellyfish@gellyfish.com>
passing in multiple file names <brock@governet.net>
Re: Perl / C Memory (Kai Henningsen)
Re: Perl / C Memory (Kai Henningsen)
Re: Perl / C Memory <gellyfish@gellyfish.com>
Re: Perl Y2k <aqumsieh@matrox.com>
Re: Please help a newbie! - sorry for the mistake! makau@my-deja.com
Re: Please help a newbie! <milanan@epix.net>
Re: Please help a newbie! (Larry Rosler)
Re: Please help a newbie! <gellyfish@gellyfish.com>
Re: Please help a newbie! (Larry Rosler)
Re: Pre-release Beta Testers <gellyfish@gellyfish.com>
Re: script to dynamically produce standard calender <gellyfish@gellyfish.com>
Re: Stock quote URL strings (Larry Rosler)
Threads question bhaskaracharya@my-deja.com
Re: trimming spaces from a string (Larry Rosler)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 15 Sep 1999 21:44:44 GMT
From: ckeith@clara.net (Colin Keith)
Subject: Re: "POW: domain error" ???
Message-Id: <grUD3.3473$O4.113814@nnrp4.clara.net>
In article <7rmtf2$g38$1@nnrp1.deja.com>, hurley_j_f@my-deja.com wrote:
>I just did a search and didn't find it in the archives.
>
>So, I get this error when trying to run my script only on NT. The error is displayed
>about twelve times requiring an OK button press, and then the script completes with
>no problems.
>Anybody?
From a man page for <math.h>
"For all functions, a domain error occurs if an input argument is outside
the domain over which the mathematical function is defined. The description
of each function lists any domain errors. On a domain error, the function
returns an implementation- defined value; the value of the EDOM macro is
stored in errno ."
"double pow(double x, double y);
Returns the value x[y]. A domain error occurs if x is negative and y is not
an integral value. A domain error occurs if the result cannot be represented
when x is 0 and y is less than or equal to 0. A range error may occur."
Not a definitive answer I know, but it might point you in the right
direction. (The MSKB indicates the errono has the macro ERRDOM)
I take it you've done the usual running the script with -w or -F to show up
any errors under other O/S's ? Just because it doesn't complain doesn't mean
its not happening. Although it could be something specific to the script on
NT (and the box being opened by the OS) What loop goes around performing
mathematical functions 12 times ... ? :)
>TIA,
>-J
hope it helps :)
Col.
------------------------------
Date: 15 Sep 1999 17:13:41 -0400
From: meow <meowing@banet.net>
Subject: Re: Abigail, Abigail, wherefore art thou, Abigail? a.k.a. Re: Error in "Learning Perl, 2nd Edition"
Message-Id: <87k8prc1yy.fsf@banet.net>
Abigail <abigail@delanet.com> wrote:
> I've heard this problem before. I have the same problem with posts of
> certain other people. The only reason I can think of is "news farms".
> My ISP doesn't have the 2 braincells to run their own newsfeed, and
> hence had to outsource it. It seems there is some competition going
> on, and news farms seem to drop posts coming from certain streams,
> for whatever reason they can come up with.
Unfortunately they also didn't have enough brain cells to pick a
reputable news provider. The reason for the propagation problems is
that newsfeeds.com are the erstwhile Sexzilla/Netzilla, who worked
really, really hard to ensure they'll never again have good outbound
connectivity :/
------------------------------
Date: 15 Sep 1999 20:52:28 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Are threads the way to go? Design Advice
Message-Id: <7rp0uc$b59$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Dan Sugalski
<dan@tuatha.sidhe.org>],
who wrote in article <D9OD3.13641$wW2.13459@news.rdc1.ct.home.com>:
> > Is there another way to do this without threads? (Since I have no
> > experience in perl threads).
>
> Fork is probably the better way to do this.
Keep in mind memory considerations as well. As experiments show,
memorywise fork() gives almost no advantage over running separate Perl
processes (14% difference reported on Solaris - with total footprint
circa 9G).
Of course, if LWP is not thread-safe, there is not much choice.
Ilya
------------------------------
Date: 15 Sep 1999 21:09:51 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Auto-responce email attachments
Message-Id: <7rp1uv$pk$1@gellyfish.btinternet.com>
On Wed, 15 Sep 1999 18:10:42 GMT Mat Tillett wrote:
> Does anyone know an easy way to attach a file to an auto-responce email?
>
Those with a well honed instinct to Laziness would use the module
MIME::Lite which is available from CPAN ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 15 Sep 1999 20:05:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI Hosting?
Message-Id: <7rou6b$m2$1@gellyfish.btinternet.com>
On Tue, 14 Sep 1999 19:23:12 +0200 _mDe_ wrote:
> Is there a free webspace provider with cgi support without all the banners
> and popups?
You will want to look at some directory that lists these things - the
Open Directory Project <http://dmoz.org> has a particular good list of
them ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 15 Sep 1999 18:52:36 +0200
From: Benjamin Schweizer <SternSZ@gmx.de>
Subject: Re: cookbook: nonforker
Message-Id: <m3so4gqfqj.fsf@anthrax.local.net>
+-->Rick Delaney <rick.delaney@home.com>:
| Benjamin Schweizer wrote:
| >
| > I´ve got a non forking daemon which is pretty nice. If I mark the
| > following code as a comment it runs pretty nice, else Perl reports
| > that IO::Select has no method has_exception.
|
| If you want that method then you should upgrade your version of
| IO::Select to the one that has that method. Better yet, upgrade your
| perl since this is a standard module.
Are you sure? My distribution is only a few months old.
Perl is relase 5.005_2 from May 1999.
Which release do I need?
regards
-Benjamin
--
100% Sig.
------------------------------
Date: Wed, 15 Sep 1999 15:53:53 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Could someone break this down for me?
Message-Id: <x3yso4gdk8e.fsf@tigre.matrox.com>
harris_m@my-deja.com writes:
> split function takes first parameter which is a string to match. The
No. split() takes a regular expression as its first argument. Not a
string.
> string has to be between two forward slashes like follows- / whatever /
which makes it a regular expression.
> In your example you have special character to match which is "|"
> For the special character you need a other (forward) slash - which looks
> like \.
That's a backslash.
--Ala
------------------------------
Date: Wed, 15 Sep 1999 14:42:44 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: HELP PARSE EMAIL ADDRESSES PLEASE
Message-Id: <MPG.1249b2b369cc16f989f73@nntp.hpl.hp.com>
In article <MKQD3.13009$N77.944663@typ11.nn.bcandid.com> on Wed, 15 Sep
1999 17:32:28 GMT, Kragen Sitaker <kragen@dnaco.net> says...
...
> I think you might mean
>
> #!perl -nw
> if (s/(^.*\s)(\S+\@\S+)(\s.*$)/\2\n/g)
> {
> print "$_";
> }
Why the quotes aound $_? For that matter, why $_?
> The perl -p puts a loop around your script which will do automatically
> what you're doing by hand.
>
> BTW, do you really mean to insert another \n before the \n at the end
> of the line, creating a blank line?
>
> You should probably change the \2 to $2.
He'd better, now that you aded the -w flag.
But why all the superfluous capturing parentheses and anchors and .*'s
and escapes and substitutions?
#!perl -nw
print "$1\n" if /\s(\S+@\S+)\s/
or
perl -nwe 'print "$1\n" if /\s(\S+@\S+)\s/'
Golf, anyone?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 15 Sep 1999 10:45:33 -0700 (PDT)
From: Michael de Beer <madebeer@igc.apc.org>
Subject: Re: HELP PARSE EMAIL ADDRESSES PLEASE
Message-Id: <APC&1'0'50775dab'b61@igc.apc.org>
use Mail::Address;
@lines = <>;
foreach $line (@lines) {
my @addrs = Mail::Address->parse($line);
foreach $addr (@addrs) {
print $addr->address,"\n";
}
};
If you want, you could change this to a while(<>){} and eliminate the
@lines and $line variables.
-Michael
------------------------------
Date: 15 Sep 1999 21:25:50 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help! Need to check
Message-Id: <7rp2su$uq$1@gellyfish.btinternet.com>
On Wed, 15 Sep 1999 11:08:19 +0200 Alex Rhomberg wrote:
> David Cassell wrote:
>
>> > @new = ();
>>
>> my new;
>
> my @new;
>
>> > @old = 1 .. 51; # just a demo
>>
>> my @old = 0 .. 51;
>>
>> Why are you starting arrays at 1 instead of 0 ?
>
> Probably because they are not array indices but values? and because
> lotto
> numbers are in the range 1..51 and rarely start at zero?
>
>> I appreciate your attempt to help, but could you:
>> [1] adhere to newsgroup standards;
>> [2] post tested, correct code; and
>> [3] not post answers previously dissed in the same thread?
>
> I'll drink to that and add:
> [4] do not post code that works but produces different results
> [5] adhere to one's standard as told others
>
> To go back to the question, here's my code:
> (faster with splice than with shuffle with these sizes)
I thought I'd weigh in with this (which gives you all the fun of
the real National Lottery )...
#!/usr/bin/perl5
%check = ();
while( scalar @nums < 6 )
{
$val = int(rand(49)) + 1;
next if $check{$val}++;
push( @nums,$val);
}
print "Content-type: text/html\n\n";
print <<EOBLAH;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transiitional//EN" >
<HTML>
<HEAD>
<TITLE>Those Lucky Lotto Numbers</TITLE>
<STYLE TYPE="text/css">
<!--
H1
{
Font-family : Comic sans ms, Arial,helvetic,sans-serif;
text-align : center;
}
P.balls
{
Font-family : Comic sans ms, Arial,helvetic,sans-serif;
text-align : center;
}
-->
</STYLE>
</HEAD>
<BODY BGCOLOR=#3399ff>
<H1 ALIGN=CENTER>
Your lucky lotto numbers
</H1>
<P CLASS="balls" ALIGN=CENTER>
<TABLE ALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR VALIGN=top>
EOBLAH
foreach (sort { $a <=> $b} @nums)
{
$ball=sprintf("ball%02d.gif",$_);
print <<EOBALLS;
<TD height=70 WIDTH=58>
<IMG SRC="http://www.national-lottery.co.uk/images/results/balls/$ball"
WIDTH=58
HEIGHT=52
ALT="$_">
</TD>
EOBALLS
}
print <<EOEND;
</TABLE>
</P>
<P>
<A HREF="http://www.gellyfish.com">
<IMG SRC="http://www.gellyfish.com/graphics/gell2.gif"
BORDER=0
ALT="Gellyfish Software">
</A>
</P>
</BODY>
</HTML>
EOEND
You can see it at <http://www.gellyfish.com/cgi-bin/lottpic.pl>
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 15 Sep 1999 21:00:40 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Hot, Fun S.F Startup Seeks a Gaggle of Perl People
Message-Id: <7rp1do$ph$1@gellyfish.btinternet.com>
On Wed, 15 Sep 1999 18:11:43 GMT Kragen Sitaker wrote:
> In article <7rolu9$ol7$1@nnrp1.deja.com>, <harad@my-deja.com> wrote:
>>great new twist on a 100 year old business, and
>>are seeking to add to our All Star team!
>
> Who's on your All Star team?
I'd go for it if they had:
Atom Ant
Secret Squirrel
Hong Kong Phooey
Scooby Doo
Dick Dastardly
Mutley
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 15 Sep 1999 21:17:33 GMT
From: buddachile@yahoo.com
Subject: Re: is this object a child of this class?
Message-Id: <7rp2d3$2fe$1@nnrp1.deja.com>
thanks for the help folks!
-marcos alves
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 15 Sep 1999 15:45:26 -0500
From: "Timothy J Flynn" <tflynn@iastate.edu>
Subject: Kerberos?
Message-Id: <7rp0h9$e3e$1@news.iastate.edu>
Hi All,
Quick question. Does anyone know of a Kerberos module for Perl? I am
running ActiveState 519. Thanks!
tflynn@iastate.edu
------------------------------
Date: 15 Sep 1999 21:50:38 +0200
From: Gisle Aas <gisle@aas.no>
Subject: Re: lwp-mirror
Message-Id: <m3emg0uf75.fsf@eik.g.aas.no>
jajacek@my-deja.com writes:
> Wenn I use lwp-mirror with option -t (timeout) I get error.
>
> #>lwp-mirror -t 10s http://www.somewhere.com file.html
>
> Can't call method "timeout" on an undefined value at
> /usr/bin/lwp-mirror line 86.
>
> Anybody knows why?
Typical symptom of a program (or maybe just an option) nobody uses.
The lwp-mirror -t-option was in fact broken by by a change to
LWP::Simple two years ago. Anyway, this fix is scheduled to be in the
next LWP release.
Regards,
Gisle
Index: lwp-mirror.PL
===================================================================
RCS file: /home/cvs/aas/perl/mods/libwww-perl/bin/lwp-mirror.PL,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -u -r1.18 -r1.19
--- lwp-mirror.PL 1997/12/03 21:21:00 1.18
+++ lwp-mirror.PL 1999/09/15 19:42:19 1.19
@@ -15,7 +15,7 @@
!GROK!THIS!
print OUT <<'!NO!SUBS!';
-# $Id: lwp-mirror.PL,v 1.18 1997/12/03 21:21:00 aas Exp $
+# $Id: lwp-mirror.PL,v 1.19 1999/09/15 19:42:19 gisle Exp $
#
# Simple mirror utility using LWP
@@ -50,19 +50,19 @@
=head1 AUTHOR
-Gisle Aas <aas@a.sn.no>
+Gisle Aas <gisle@aas.no>
=cut
-use LWP::Simple;
+use LWP::Simple qw(mirror is_success status_message $ua);
use Getopt::Std;
$progname = $0;
$progname =~ s,.*/,,; # use basename only
$progname =~ s/\.\w*$//; #strip extension if any
-$VERSION = sprintf("%d.%02d", q$Revision: 1.18 $ =~ /(\d+)\.(\d+)/);
+$VERSION = sprintf("%d.%02d", q$Revision: 1.19 $ =~ /(\d+)\.(\d+)/);
$opt_h = undef; # print usage
$opt_v = undef; # print version
@@ -78,7 +78,7 @@
die <<"EOT";
This is lwp-mirror version $VERSION ($DISTNAME)
-Copyright 1995-1996, Gisle Aas.
+Copyright 1995-1999, Gisle Aas.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
@@ -95,7 +95,7 @@
$timeout = $1;
$timeout *= 60 if ($2 eq "m");
$timeout *= 3600 if ($2 eq "h");
- $LWP::Simple::ua->timeout($timeout);
+ $ua->timeout($timeout);
}
$rc = mirror($url, $file);
------------------------------
Date: Wed, 15 Sep 1999 17:43:52 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: message passing in socket comm.
Message-Id: <37E01318.69A76DF7@patriot.net>
If you're using sockets, why not just use IO::Socket, and print to the
filehandle for the
the socket?
Matilda Dahlqvist wrote:
> I want to do a server-client communication and I am using
>
> send SOCKET, MSG, FLAGS
>
> in order to send messages from the client to the server.
>
> What do I need to do if I want to declare the length of the message, for
> example 40 bytes? The message might only be "hello" but I still want it to
> be 40 bytes long
>
> Matilda
>
> Don't criticize a man until you've walked a mile in his shoes,
> that way when you criticize him you're a mile away
> and have his shoes.
------------------------------
Date: Wed, 15 Sep 1999 22:04:56 GMT
From: Dustin Aleksiuk <daleksiuk@home.com>
Subject: newbie can't figure out a RE
Message-Id: <37E0180C.46822FF1@home.com>
Hello folks,
I'm brand new to perl (as of yesterday). I'm trying to figure out a way
to index words in a textfile. It's working fine, but I need to get rid
of all punctuation except for apostrophes. I did this to lowercase
everything and then get rid of all non-alphabet characters:
$aWord =~ tr/A-Z/a-z/;
$aWord =~ tr/a-z//cd;
It works fine, but words like don't come out as dont. I'm looking for a
way to say, 'get rid of all punctuation BUT apostrophes.
Thanks,
Dustin Aleksiuk
------------------------------
Date: Wed, 15 Sep 1999 13:21:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Parsing Tab Delimited File
Message-Id: <MPG.12499f96b7811a18989f6e@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <37dfe000@cs.colorado.edu> on 15 Sep 1999 12:05:52 -0700, Tom
Christiansen <tchrist@mox.perl.com> says...
...
> Now, unless you're Microscrewed, you probably just want
>
> while ($record = <FH>) {
> chomp($record);
> @fields = split(/\t/,$record);
> ....
> }
What different would he want were he Microscrewed?
And why be so verbose?
while (<FH>) {
chomp;
my @fields = split /\t/;
....
}
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 15 Sep 1999 20:36:20 GMT
From: stampede <hardpack@my-deja.com>
Subject: Re: Parsing Tab Delimited File
Message-Id: <7rp003$oe$1@nnrp1.deja.com>
In article <7ro7uu$dge$1@nnrp1.deja.com>,
brian_fredette@vnet.ibm.com wrote:
> I'm having some trouble finding information on how to parse a tab
> delimited text file. Any pointers would be appreciated.
foreach (<FILE>) {
my $line = chomp($_);
my @columns = split(/\t+/, $line);
&process_columns_here(@columns);
}
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 15 Sep 1999 15:02:35 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Parsing Tab Delimited File
Message-Id: <37e0096b@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
lr@hpl.hp.com (Larry Rosler) writes:
:What different would he want were he Microscrewed?
How do you have a tab in tab-separated data? I've seen
schemes that do really odd things.
:And why be so verbose?
I thought it would be more explicit.
--tom
--
San Francisco, n.:
Marcel Proust editing an issue of Penthouse.
------------------------------
Date: Wed, 15 Sep 1999 14:49:05 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Parsing Tab Delimited File
Message-Id: <MPG.1249b4284e84d48c989f74@nntp.hpl.hp.com>
In article <7rp003$oe$1@nnrp1.deja.com> on Wed, 15 Sep 1999 20:36:20
GMT, stampede <hardpack@my-deja.com> says...
> In article <7ro7uu$dge$1@nnrp1.deja.com>,
> brian_fredette@vnet.ibm.com wrote:
> > I'm having some trouble finding information on how to parse a tab
> > delimited text file. Any pointers would be appreciated.
>
> foreach (<FILE>) {
> my $line = chomp($_);
Do you know what the value returned by chomp() is? `perldoc -f chomp`
to see.
chomp(my $line = $_);
But why not just do
chomp;
and leave off the second argument to the split()?
> my @columns = split(/\t+/, $line);
Successive tabs should produce null fields. The '+' is incorrect.
> &process_columns_here(@columns);
> }
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 15 Sep 1999 14:54:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Parsing Tab Delimited File
Message-Id: <MPG.1249b5714beb3681989f75@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <37e0096b@cs.colorado.edu> on 15 Sep 1999 15:02:35 -0700, Tom
Christiansen <tchrist@mox.perl.com> says...
> In comp.lang.perl.misc,
> lr@hpl.hp.com (Larry Rosler) writes:
> :What different would he want were he Microscrewed?
>
> How do you have a tab in tab-separated data?
#!/usr/bin/perl -w
use strict;
print unpack('H*' => "a\tb\tc\n"), " $^O\n";
__END__
Output:
61096209630a MSWin32
> I've seen schemes that do really odd things.
Not Micro$..t, though.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 15 Sep 1999 20:30:19 GMT
From: stampede <stampede3@yourcompass.com>
Subject: passing "=" as an argument to CGI
Message-Id: <7rovkt$cm$1@nnrp1.deja.com>
is there a way to pass an "=" as an argument to CGI?
e.g.,
http://www.foo.org/perl.cgi?url=http://www.foo.com/perl.cgi?x=y
so that foo.com/perl.cgi processes the value "y" as param('x')?
some kind of encoding or special filter to protect "="? or
is there even a standard for writing your own? like:
http://www.foo.org/perl.cgi?url=(http://www.foo.com/perl.cgi?x=y)
(which probably won't work, either; but it's an example.)
thanks!
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 15 Sep 1999 21:46:25 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: passing "=" as an argument to CGI
Message-Id: <7rp43h$11f$1@gellyfish.btinternet.com>
On Wed, 15 Sep 1999 20:30:19 GMT stampede wrote:
> is there a way to pass an "=" as an argument to CGI?
>
> e.g.,
>
> http://www.foo.org/perl.cgi?url=http://www.foo.com/perl.cgi?x=y
>
> so that foo.com/perl.cgi processes the value "y" as param('x')?
>
I'm not sure what you mean ...
If you mean that you want to post that second URL as a parameter to
the first CGI program then you will want to encode it like:
$string = 'http://www.foo.com/perl.cgi?x=y';
$string =~ s/([^A-Za-z0-9])/sprintf("%%%02X",ord($1))/eg;
which is probably overkill (in the characters it encodes ) but wont hurt.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 15 Sep 1999 16:03:55 -0600
From: Darren Brock <brock@governet.net>
Subject: passing in multiple file names
Message-Id: <37E017CB.668FF359@governet.net>
This is a multi-part message in MIME format.
--------------031729972355E8F08B66AAA1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi
I want to pass in a couple thousand file names that I have written a
parser for. The parser will currently take 1 file as an argument and
spit out the parsed text to a new file.
My problem is getting the script to take multiple filenames and then
loop over the parser with each. How can I do that?
Thanks
Darren
--------------031729972355E8F08B66AAA1
Content-Type: text/x-vcard; charset=us-ascii;
name="brock.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Darren Brock
Content-Disposition: attachment;
filename="brock.vcf"
begin:vcard
n:Brock;Darren
tel;work:208-522-1225
x-mozilla-html:FALSE
url:http://www.governet.net
org:Governet;R&D
adr:;;101 Technology Dr.;Idaho Falls;ID;83401;USA
version:2.1
email;internet:brock@governet.net
title:Oracle Developer/DBA
fn:Darren Brock
end:vcard
--------------031729972355E8F08B66AAA1--
------------------------------
Date: 15 Sep 1999 20:34:00 +0200
From: kaih=7OwuJ5B1w-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: Perl / C Memory
Message-Id: <7OwuJ5B1w-B@khms.westfalen.de>
mgjv@comdyn.com.au (Martien Verbruggen) wrote on 15.09.99 in <5hBD3.107$LN1.4551@nsw.nnrp.telstra.net>:
> 4.3BSD is the first one to have anonymous mmaps. I suspect that linux
> actually borrowed this BSD-ism in recent times.
Exactly.
> PS. I'm not sure about the parentage of 386BSD, which may actually
> have its roots in 4.3BSD.
Somewhere between 4.3 and 4.4, IIRC.
Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
- Russ Allbery (rra@stanford.edu)
------------------------------
Date: 15 Sep 1999 20:38:00 +0200
From: kaih=7OwuJTSXw-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: Perl / C Memory
Message-Id: <7OwuJTSXw-B@khms.westfalen.de>
dan@tuatha.sidhe.org (Dan Sugalski) wrote on 14.09.99 in <qquD3.13466$wW2.11607@news.rdc1.ct.home.com>:
> Kai Henningsen <kaih=7OmmKH$1w-B@khms.westfalen.de> wrote:
> > dan@tuatha.sidhe.org (Dan Sugalski) wrote on 12.09.99 in
> > <hzUC3.5897$wW2.8602@news.rdc1.ct.home.com>:
>
> >> Kai Henningsen <kaih=7OhjZZ$mw-B@khms.westfalen.de> wrote:
> >> > dan@tuatha.sidhe.org (Dan Sugalski) wrote on 04.09.99 in
> >> > <sf_z3.148$lT.809@news.rdc1.ct.home.com>:
> >>
> >> >> Sure it does. Unfortunately just because perl frees memory doesn't
> >> >> mean memory is returned back to the system. With very few exceptions
> >> >> (I think MacOS and, under a few circumstances, VMS) any memory
> >> >> allocated to a process by the OS stays with that process until it
> >> >> exits. This isn't a perl thing--any program that mallocs memory will
> >> >> do it.
> >>
> >> > Linux with glibc2 can also, I gather, return free()d memory to the OS.
> >>
> >> > The way to do that is to not use brk(), but instead use mmap() to get
> >> > the memory. Then you can munmap() it again.
> >>
> >> Well, OK, you can do that with any OS that implements mmap, but mapping
> >> files to memory just so you can free it later seems a tad weasly.
>
> > Why?
>
> Because the purpose of mmap was to map disk files to memory. That's not
> what we're doing.
So?
> >> A better thing to do would be for someone to go ahead and fix the various
> >> C libraries to hand free'd memory back, but it's been 30 years and
> >> nobody's done it yet, so I probably shouldn't hold my breath.
>
> > Because it's impossible in general if done with brk(). The number of
> > processes that ever free significant amounts of memory at the upper bound
> > is microscopic.
>
> Who cares if the memory's not freed at the top of the heap? So you return
> pages in the middle of your process' memory and have a gap. Big deal. If
> you're returning memory, presumably you're actually keeping track of what
> memory is in use. In which case holes are not a problem.
That's with mmap().
If you do it with brk(), you *can't* do holes.
That's what I was pointing out.
> > It's called a heap because it doesn't behave like a stack.
>
> So why treat it as one?
Ask the people who designed brk().
Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
- Russ Allbery (rra@stanford.edu)
------------------------------
Date: 15 Sep 1999 21:29:17 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl / C Memory
Message-Id: <7rp33d$v8$1@gellyfish.btinternet.com>
On Tue, 14 Sep 1999 23:56:49 GMT Martien Verbruggen wrote:
> In article <nmuD3.13465$wW2.11607@news.rdc1.ct.home.com>,
> Dan Sugalski <dan@tuatha.sidhe.org> writes:
>
>> And anonymous mmap looks to be a linux-only feature.
>
>> since the feature you're looking at
>> (anonymous mmap) is tagged as linux only.
>
> \begin[unix]{offtopic}
>
> That's not entirely true. Flavours of Unix that do anonymous mmaps that
> I know of:
>
> 386BSD 0.0 +
> 4.3BSd (various flavours)
> 4.4BSD
> NetBSD 1.2 +
> FreeBSD (all versions I think)
> OpenBSD (all versions I think)
> I can't recall whether Ultrix had this or not, but I seem to vaguely
> remember something about it, it's too long ago.
> None of the SVR4 systems I know has anonymous mmaps.
Linux does too.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 15 Sep 1999 15:47:31 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Perl Y2k
Message-Id: <x3yu2owdkj0.fsf@tigre.matrox.com>
bart.lateur@skynet.be (Bart Lateur) writes:
> Chris Nandor wrote:
>
> >You would rather waste 5 seconds of the thousands of people who read this
> >newsgroup instead of taking a few minutes yourself to look up the answer
> >in the readily available documentation.
>
> <Yawn> here we go again. Hey people! Do we HAVE to have these
> degenerated threads three times a day?
Yes. Doctor's orders. Once before every meal. Overdosage is ok.
--Ala
------------------------------
Date: Wed, 15 Sep 1999 21:49:42 GMT
From: makau@my-deja.com
Subject: Re: Please help a newbie! - sorry for the mistake!
Message-Id: <7rp49h$3qj$1@nnrp1.deja.com>
It's me!
Sorry but I was so much excited that I commited a few mistakes in my
code.
Here's is a much cleaner code :
-------------------------------------------------------------
#!/usr/local/perl -w
use strict;
my $data;
open (INPUT,"./input.txt") or die $!;
open (OUTPUT,">./output.txt") or die $!;
while (<INPUT>) {
m!^(.{180})(\d{2})(\d{2})(\d{2})(.*)!;
$data .= "$1$2/$3/$4$5";
};
print OUTPUT $data;
close (OUTPUT);
close (INPUT);
print "Finished!\n";
-------------------------------------------------------------
Makau.
In article <7rokdr$ndp$1@nnrp1.deja.com>,
sg95m476@dunx1.ocs.drexel.edu wrote:
> Please help a perl newbie:
>
> I have a text file. For every line of the file in character positions
> 181-186 there are date values in the format MMDDYY. What I would like
> to do is modify this to a MM/DD/YY format, inserting slashes between
MM,
> DD, and YY for every line of the file - thus expanding the character
> position range of this date format for every line from character
> positions 181-188.
>
> Can anyone help me with this?
>
> Thanks!
>
> Chuck
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 15 Sep 1999 20:09:01 GMT
From: Milana Nastetskaya <milanan@epix.net>
Subject: Re: Please help a newbie!
Message-Id: <37DFFCD5.2B10852E@epix.net>
You need to use unpack() function to split MMDDYY into three variables:
$MM, $DD and $YY. E.g.
($MM,$DD,$YY)=unpack("A2A2A2", $MMDDYY);
First, of course you need to write into that $MMDDYY variable the date from
the file...
sg95m476@dunx1.ocs.drexel.edu wrote:
> Please help a perl newbie:
>
> I have a text file. For every line of the file in character positions
> 181-186 there are date values in the format MMDDYY. What I would like
> to do is modify this to a MM/DD/YY format, inserting slashes between MM,
> DD, and YY for every line of the file - thus expanding the character
> position range of this date format for every line from character
> positions 181-188.
>
> Can anyone help me with this?
>
> Thanks!
>
> Chuck
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
--
-------------------------
Milana Nastetskaya
Web Developer, The Sentinel
Carlisle, PA (717) 243-2611
mailto:milanan@epix.net
http://www.cs.sunyit.edu/~nastetm
------------------------------
Date: Wed, 15 Sep 1999 13:36:44 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Please help a newbie!
Message-Id: <MPG.1249a335ca548e04989f70@nntp.hpl.hp.com>
In article <oeRD3.13147$N77.951179@typ11.nn.bcandid.com> on Wed, 15 Sep
1999 18:06:12 GMT, Kragen Sitaker <kragen@dnaco.net> says...
> In article <37DFDD9E.8B8B7E7E@cisco.com>,
> Makarand Kulkarni <makkulka@cisco.com> wrote:
> >And don't you think you should expand to mm/dd/YYYY to take
> >care of Y2K issues !!
>
> Oh yes, I forgot to flame about this. Whoever defined this mm/dd/yy
> format for storing your data should be taken out and shot in 01/01/00.
Reading responses such as these makes me wonder why Abigail and I spent
so much time this week enlightening Benjamin Franz on the error
underlying this kind of dogmatism. What a waste of effort! Sigh...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 15 Sep 1999 21:38:46 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Please help a newbie!
Message-Id: <7rp3l6$10j$1@gellyfish.btinternet.com>
On Wed, 15 Sep 1999 18:06:12 GMT Kragen Sitaker wrote:
> In article <37DFDD9E.8B8B7E7E@cisco.com>,
> Makarand Kulkarni <makkulka@cisco.com> wrote:
>>And don't you think you should expand to mm/dd/YYYY to take
>>care of Y2K issues !!
>
> Oh yes, I forgot to flame about this. Whoever defined this mm/dd/yy
> format for storing your data should be taken out and shot in 01/01/00.
Why ?
I for one have no way of knowing whether this will cause a problem or
whether '01/01/00' will be ambiguous (as to the year) within the context
of the dataset it comes from.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 15 Sep 1999 14:58:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Please help a newbie!
Message-Id: <MPG.1249b66ad84b0584989f77@nntp.hpl.hp.com>
In article <37DFFCD5.2B10852E@epix.net> on Wed, 15 Sep 1999 20:09:01
GMT, Milana Nastetskaya <milanan@epix.net> says...
> You need to use unpack() function to split MMDDYY into three variables:
> $MM, $DD and $YY. E.g.
>
> ($MM,$DD,$YY)=unpack("A2A2A2", $MMDDYY);
>
> First, of course you need to write into that $MMDDYY variable the date from
> the file...
Urk.
How about a simple one-liner solution to this trivial problem:
substr($s, 183, 2) = '/' . substr($s, 183, 2) . '/';
Or, for the masochists who want to win at Perl Golf:
substr($s,183,2)="/${\substr$s,183,2}/";
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 15 Sep 1999 20:01:36 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Pre-release Beta Testers
Message-Id: <7rotv0$lv$1@gellyfish.btinternet.com>
On Tue, 14 Sep 1999 15:14:55 -0700 Larry Rosler wrote:
> In article <37DEBB1F.2694079C@mail.cor.epa.gov> on Tue, 14 Sep 1999
> 14:16:15 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> ...
>> Will Larry R get another "Certified Perl Pornographer" paper?
>
> That's "Certifiable Perl Pornographer", and I bought it from mjd at Perl
> Conference 2.0. What I got from Tekmetrics was "Master Perl
> Programmer". I value the former certificate far more highly.
>
I appear to have lost the rather cheezy TekMetrics certificate but hey I
got spammed by them suggesting I could take another test for free ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 15 Sep 1999 20:47:20 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: script to dynamically produce standard calender
Message-Id: <7rp0ko$pc$1@gellyfish.btinternet.com>
On Wed, 15 Sep 1999 12:30:34 +0100 Mark Hamlin wrote:
> Hi,
>
> I'm after a script to dynamically produce calendar output, i.e. a small
> table for each month (text only) with 7 columns - one for each day, and the
> days represented by the number (bog standard calendar - you know what I
> mean). If you have something suitable handy or know where such a thing is
> available on-line or even a book that it is in, I'd really appreciate it if
> you could send me an email me (and tell me about it, not just gloat!).
>
I was sitting at work after reading this earlier thinking that I had done
or at least started something like this and so I had - truly awful it is
too - so here it is only a very little cleaned up - guess that you could
work out what to with it ...
#!/usr/bin/perl -w
use strict;
use Date::Calc qw(:all);
use CGI qw(:standard);
my @stuff = localtime;
my $me = script_name;
my ($pyear,$pmonth,$myear,$mmonth);
print header;
if(($pyear = param('year')) && ($pmonth = param('month')))
{
$myear = $pyear;
$mmonth = $pmonth;
}
else
{
$myear = $stuff[5] + 1900;
$mmonth = $stuff[4] + 1;
}
my $disp_type = param('type');
my ( $last_year,$last_month,$next_year,$next_month)
= neighbouring_periods($myear,$mmonth);
my $weekday = Day_of_Week($myear,$mmonth,1);
my $this_month_name = Month_to_Text($mmonth);
my $last_month_name = Month_to_Text($last_month);
my $next_month_name = Month_to_Text($next_month);
if ($disp_type eq 'detail')
{
my $this_day = param('day');
my @yesterday = Add_Delta_Days($myear,$mmonth,$this_day,-1);
my @tommorrow = Add_Delta_Days($myear,$mmonth,$this_day,1);
$last_month_name = Month_to_Text($yesterday[1]);
$next_month_name = Month_to_Text($tommorrow[1]);
my $query_date = $myear . $mmonth . $this_day;
print <<OOLALA;
<HTML>
<BODY>
<P ALIGN=CENTER>
<TABLE BORDER=0 WIDTH=75%>
<TR WIDTH=75%>
<TD WIDTH=25% ALIGN=left>
<A HREF=$me?month=$yesterday[1]&year=$yesterday[0]&day=$yesterday[2]&type=detail>
$yesterday[2] $last_month_name $yesterday[0]
</A>
</TD>
<TD WIDTH=25% ALIGN=center>
<H2>$this_day $this_month_name $myear</H2>
<BR>
</TD>
<TD WIDTH=25% ALIGN=right>
<A HREF=$me?month=$tommorrow[1]&year=$tommorrow[0]&day=$tommorrow[2]&type=detail>
$tommorrow[2] $next_month_name $tommorrow[0]
</A>
</TD>
</TR>
</TABLE>
</P>
OOLALA
my @fields;
if ((@fields = date_query($query_date)) > 0 )
{
my $fields;
print <<EOGFG;
<TABLE WIDTH=100%>
EOGFG
foreach $fields (@fields)
{
print <<EELPIE;
<TR WIDTH=100%>
<TD>
$fields->[1]
</TD>
<TD>
$fields->[2]
</TD>
<TD>
$fields->[3]
</TD>
<TD>
$fields->[4]
</TD>
</TR>
EELPIE
}
</TABLE>
}
else
{
print "<H3 ALIGN=center>No Records</H3>\n";
}
print end_html;
}
else
{
print <<EOW;
<HTML>
<BODY>
<P ALIGN=CENTER>
<TABLE BORDER=0 WIDTH=75%>
<TR WIDTH=75%>
<TD WIDTH=25% ALIGN=left>
<A HREF=$me?month=$last_month&year=$last_year>
$last_month_name $last_year
</A>
</TD>
<TD WIDTH=25% ALIGN=center>
<H2>$this_month_name $myear</H2>
<BR>
</TD>
<TD WIDTH=25% ALIGN=right>
<A HREF=$me?month=$next_month&year=$next_year>
$next_month_name $next_year
</A>
</TD>
</TR>
</TABLE>
</P>
<TABLE HEIGHT=75% WIDTH=100% BORDER=1 VALIGN=TOP ALIGN=LEFT>
<TR>
<TD WIDTH=14% BGCOLOR="gray" ALIGN=CENTER>
Monday
</TD>
<TD WIDTH=14% BGCOLOR="gray" ALIGN=CENTER>
Tuesday
</TD>
<TD WIDTH=14% BGCOLOR="gray" ALIGN=CENTER>
Wednesday
</TD>
<TD WIDTH=14% BGCOLOR="gray" ALIGN=CENTER>
Thursday
</TD>
<TD WIDTH=14% BGCOLOR="gray" ALIGN=CENTER>
Friday
</TD>
<TD WIDTH=14% BGCOLOR="gray" ALIGN=CENTER>
Saturday
</TD>
<TD WIDTH=14% BGCOLOR="gray" ALIGN=CENTER>
Sunday
</TD>
EOW
my $monthday = 0;
for (0 .. 41)
{
my $dow = (($_ % 7) + 1 );
if ($dow == 1)
{
print "<TR>";
}
print "<TD WIDTH=14% VALIGN=top ALIGN=left>\n";
if ( ($_ >= $weekday - 1 ) && ($monthday <= Days_in_Month($myear,$mmonth )))
{
$monthday++;
print "<A HREF='$me?type=detail&day=$monthday&year=$myear&month=$mmonth'>\n";
print $monthday;
print "</A>\n";
}
print "<BR>\n</TD>\n";
if ($dow == 7)
{
print "</TR>";
if ( $monthday >= Days_in_Month($myear,$mmonth) )
{
print "</TABLE>\n";
last;
}
}
}
print end_html;
}
sub neighbouring_periods
{
my ($this_year,$this_month ) = @_;
my ($last_year,$last_month,$next_year,$next_month) = ();
if ( $this_month == 1)
{
$last_year = $this_year - 1 ;
$last_month = 12;
$next_month = $this_month + 1;
$next_year = $this_year;
}
elsif ($this_month == 12 )
{
$next_month = 1;
$next_year = $this_year + 1;
$last_year = $this_year;
$last_month = $this_month - 1;
}
else
{
$last_year = $next_year = $this_year;
$last_month = $this_month - 1;
$next_month = $this_month + 1;
}
return ($last_year,$last_month,$next_year,$next_month);
}
sub date_query
{
my $query_date = shift;
#
# do something that will return a LoL
#
return ();
}
Have fun ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 15 Sep 1999 13:23:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Stock quote URL strings
Message-Id: <MPG.1249a026370e2de8989f6f@nntp.hpl.hp.com>
In article <4JRD3.13222$N77.953872@typ11.nn.bcandid.com> on Wed, 15 Sep
1999 18:38:56 GMT, Kragen Sitaker <kragen@dnaco.net> says...
> I'm reposting the article in text so people can read it. (trn 4
> decodes base64 automatically.)
>
> In article <7ro97s$6t2$1@news2.tor.accglobal.net>,
> Michael Kraizman <Michael_Kraizman@excite.com> wrote:
> >I'm writing a PERL module to retrieve stock quotes from the various
> >quote engines on the web. I've managed to find one URL that will
> >return a stock quote from the Yahoo server in comma separated
> >value format
> >("http://quote.yahoo.com/d/quotes.csv?s=$symbol&f=sl1d1t1c1ohgvj1pp2owern&e=.csv")
> >Does anybody know of any other URLs that will do the same, like
> >for excite, or Infoseek or others?
Why did you bother, when the question is off-topic?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 15 Sep 1999 20:20:14 GMT
From: bhaskaracharya@my-deja.com
Subject: Threads question
Message-Id: <7rov1f$vr0$1@nnrp1.deja.com>
hi,
I have a simple question on threads.
I have 10 items in array and run 2 subs sub1 and sub2 which is
to be sequential but the 10 are independent. I do this this way
but is it possible to run it in one foreach loop? what happens if i have
to run 10 subs sequentially..10 foreach koops make it ugly...
i know i can use thr->join to make a thread wait but then it does
wait for each item in the array. Please help...
foreach (@array)
{
my $thr = new Thread \&sub, $_; # starts new threads
$thr->detach; # don't care let it run
}
foreach (@array)
{
my $thr = new Thread \&sub2, $_; # start again
$thr->detach; # don't care
}
thanks
-bhaskar
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 15 Sep 1999 13:48:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: trimming spaces from a string
Message-Id: <MPG.1249a5df7d34dc56989f71@nntp.hpl.hp.com>
In article <x3ywvtsdq2p.fsf@tigre.matrox.com> on Wed, 15 Sep 1999
13:47:42 -0400, Ala Qumsieh <aqumsieh@matrox.com> says...
> kragen@dnaco.net (Kragen Sitaker) writes:
> > In article <7rmr41$4lv$1@bgtnsc01.worldnet.att.net>,
> > Dolly & Will Cardwell <wellhaven@worldnet.att.net> wrote:
> > >$s=' aa bcdef ';
> > >$t='aa bcdef';
> >
> > $s =~ s/^\s*(.*?)\s*$/$1/;
>
> That doesn't solve the problem. $s is still not the same as $t. You
> also need:
>
> $t =~ s/^\s+|\s+$/g; # just in case
Neither of you seems to have read perlfaq4: "How do I strip blank space
from the beginning/end of a string?" It says some rather
uncomplimentary things about these approaches.
> $s =~ s/\s+/ /g;
> $t =~ s/\s+/ /g;
tr/ \n\r\f\t/ /s for $s, $t;
is much more appropriate. Actually though, the problem statements talks
only about spaces, so all those other white-space characters are
unnecessary; furthermore it talks only about leading and trailing
spaces, so squeezing the interior spaces isn't called for. The two
strings don't match because their interior spaces don't match.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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.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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 V9 Issue 809
*************************************