[19721] in Perl-Users-Digest
Perl-Users Digest, Issue: 1916 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 12 03:05:36 2001
Date: Fri, 12 Oct 2001 00:05:10 -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: <1002870309-v10-i1916@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 12 Oct 2001 Volume: 10 Number: 1916
Today's topics:
Re: $5 -> 7 back issues of "The Perl Journal" <matthew.garrish@sympatico.ca>
Re: $5 -> 7 back issues of "The Perl Journal" (Martien Verbruggen)
Re: Anyone know of a SNMP MIB browser (Cameron Laird)
FA: $5 -> 7 back issues of "The Perl Journal" <lwbecker2@hotmail.com>
HELP! why doesn't stat work? <gvandyke@voyager.net>
Re: HELP! why doesn't stat work? <wyzelli@yahoo.com>
Re: HELP! why doesn't stat work? (John J. Trammell)
Re: Integration (Logan Shaw)
Larry Wall siting <jthomson110@home.com>
Lightweight Languages Workshop, Cambridge MA 11/17/01 <mmssaalliibb@mmiitt.eedduu>
Re: Lightweight Languages Workshop, Cambridge MA 11/17/ (Kaz Kylheku)
Re: Lightweight Languages Workshop, Cambridge MA 11/17/ <Arjen.Markus@wldelft.nl>
Need help with a Regular Expression (2obvious)
Re: Need help with a Regular Expression <wyzelli@yahoo.com>
Re: Need help with a Regular Expression <wyzelli@yahoo.com>
Re: Need help with a Regular Expression (Martien Verbruggen)
Re: Need help with a Regular Expression <krahnj@acm.org>
Re: Need help with a Regular Expression <krahnj@acm.org>
open file for appending <yah00204052@yahoo.com>
Re: open file for appending <tony_curtis32@yahoo.com>
Re: Pattern Matching <goldbb2@earthlink.net>
Perl Power Limits? <notspam@spamfree.dud>
Re: Perl Power Limits? <rob_13@excite.com>
Re: Perl Power Limits? (Martien Verbruggen)
problem on compiling <cheung_walter@yahoo.com>
Re: Stop Transversal of a Directory with Tar and Unzip <goldbb2@earthlink.net>
Re: Uploading <aneely@softouch.on.ca>
Re: YOU ARE ALL GAY! <geoffrey@bigpond.net.au>
Re: YOU ARE ALL GAY! <tmoero@yahoo.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 12 Oct 2001 02:16:04 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: $5 -> 7 back issues of "The Perl Journal"
Message-Id: <wQvx7.30835$xy1.3024697@news20.bellglobal.com>
"lbecker" <lwbecker2@hotmail.com> wrote in message
news:imkcstkpakq4ape0e9rveok8cn8aaliksq@4ax.com...
> 7 mint issues of The Perl Journal, if interested go to:
>
> http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item=1474131023
what happened to the days when people threw their old crap in the garbage?
Matt
------------------------------
Date: Fri, 12 Oct 2001 06:37:01 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: $5 -> 7 back issues of "The Perl Journal"
Message-Id: <slrn9sd3sd.l88.mgjv@verbruggen.comdyn.com.au>
On Fri, 12 Oct 2001 02:16:04 -0400,
Matt Garrish <matthew.garrish@sympatico.ca> wrote:
>
> "lbecker" <lwbecker2@hotmail.com> wrote in message
> news:imkcstkpakq4ape0e9rveok8cn8aaliksq@4ax.com...
>> 7 mint issues of The Perl Journal, if interested go to:
>>
>> http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item=1474131023
>
> what happened to the days when people threw their old crap in the garbage?
They still do. Didn't you notice it was on ebay?
Martien
--
Martien Verbruggen |
Interactive Media Division | Think of the average person. Half of
Commercial Dynamics Pty. Ltd. | the people out there are dumber.
NSW, Australia |
------------------------------
Date: 11 Oct 2001 20:47:18 -0500
From: claird@starbase.neosoft.com (Cameron Laird)
Subject: Re: Anyone know of a SNMP MIB browser
Message-Id: <86006660F75BCA98.326E252438FBC27B.89E7D95797BF15B2@lp.airnews.net>
In article <7EB97BF7C3E7EFC5.AD082038A05688C5.133C5F0788500477@lp.airnews.net>,
Tony McIver <tmciver@yottanetworks.com> wrote:
>Hello All,
> I am writing a perl script that uses the NET::SNMP module. I need to get
>a MIB browser so I don't have to figure out all of the OID's manually. Does
>anyone know of a free MIB browser out on the web somewhere. It would really
>be a big help if I could find one.
.
.
.
There are lots. Although I know of none coded in Perl,
my guess would be that there's at least one.
You'll want to give the folks in comp.protocols.snmp a
chance to help you.
--
Cameron Laird <claird@NeoSoft.com>
Business: http://www.Phaseit.net
Personal: http://starbase.neosoft.com/~claird/home.html
------------------------------
Date: Fri, 12 Oct 2001 02:22:34 GMT
From: lbecker <lwbecker2@hotmail.com>
Subject: FA: $5 -> 7 back issues of "The Perl Journal"
Message-Id: <imkcstkpakq4ape0e9rveok8cn8aaliksq@4ax.com>
7 mint issues of The Perl Journal, if interested go to:
http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item=1474131023
------------------------------
Date: Thu, 11 Oct 2001 20:30:52 -0500
From: "George Vandyke" <gvandyke@voyager.net>
Subject: HELP! why doesn't stat work?
Message-Id: <3bc64913$0$43574$272ea4a1@news.execpc.com>
Hello All,
I am having a difficult time using the stat function to determine if a file
is
older than 1 week. I tried using the stat function and it is not working.
Thanks for any help. my version on perl is perl, v5.6.1 built for
MSWin32-x86-multi-thread
Below is the code I used and the output, If there is an easier way to do
this
please tell me:
#****************************** CODE ***********************************
# D:\SDRC_Projects\CleanTDM\test_stat.pl
use File::stat;
$filename="d:\\Ideas\\Team_8\\Scratch\\z_master_3284.smd";
print ("\ntry 1:");
($WRITETIME) = (stat($filename))[9];
print ("\nfilename = $filename ; writetime = $WRITETIME");
print ("\ntry 2:");
@file_stats = stat $filename;
$WRITETIME2 = $file_stats[9];
print ("\nfilename = $filename ; writetime = $WRITETIME");
print ("\narray file_stats = @file_stats");
print ("\n***** DONE *****");
***************************** OUTPUT ****************************
try 1:
filename = d:\Ideas\Team_8\Scratch\z_master_3284.smd ; writetime =
try 2:
filename = d:\Ideas\Team_8\Scratch\z_master_3284.smd ; writetime =
array file_stats = File::stat=ARRAY(0x1a756ac)
***** DONE *****
--
George Vandyke
gvandyke@voyager.net
------------------------------
Date: Fri, 12 Oct 2001 11:43:20 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: HELP! why doesn't stat work?
Message-Id: <Ccsx7.32$dv.506@wa.nnrp.telstra.net>
"George Vandyke" <gvandyke@voyager.net> wrote in message
news:3bc64913$0$43574$272ea4a1@news.execpc.com...
> Hello All,
>
> I am having a difficult time using the stat function to determine if a
file
> is
> older than 1 week. I tried using the stat function and it is not working.
> Thanks for any help. my version on perl is perl, v5.6.1 built for
> MSWin32-x86-multi-thread
>
> Below is the code I used and the output, If there is an easier way to do
> this
> please tell me:
>
> #****************************** CODE ***********************************
> # D:\SDRC_Projects\CleanTDM\test_stat.pl
>
> use File::stat;
>
> $filename="d:\\Ideas\\Team_8\\Scratch\\z_master_3284.smd";
>
> print ("\ntry 1:");
> ($WRITETIME) = (stat($filename))[9];
Using File::stat overrides the default stat. The default stat returns an
array so this would work. File::stat returns a reference to an array (OO)
which is why this doesn't work.
Either dereference the array, referenced by $WRITETIME or for the method you
are using, use the builtin stat (don't use the module).
HTH
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";
------------------------------
Date: Thu, 11 Oct 2001 21:14:23 -0500
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: HELP! why doesn't stat work?
Message-Id: <slrn9sckfu.nl3.trammell@haqq.hypersloth.net>
On Thu, 11 Oct 2001 20:30:52 -0500, George Vandyke wrote:
[snip]
http://www.tuxedo.org/~esr/faqs/smart-questions.html
--
[W]hen the manager knows his boss will accept status reports without
panic or preeemption, he comes to give honest appraisals.
- F. Brooks, _The Mythical Man-Month_
------------------------------
Date: 12 Oct 2001 00:43:35 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Integration
Message-Id: <9q5vu7$ho5$1@charity.cs.utexas.edu>
In article <9q4nlp$ac0$1@jetsam.uits.indiana.edu>,
Ben Ridenhour <bridenho@bio.indiana.edu> wrote:
>Is there a way to make perl do integration (and perhaps other calculus
>functions)? I'm running some simulations in mathematica and they are
>horribly slow, so I thought maybe I could do them in perl and speed up the
>algorithms...
Hmm... I would think Mathematica or one of the similar products would
have pretty fast routines to do numerical stuff like that, since that's
sort of its focus.
The closest thing I can think is PDL; see http://pdl.perl.org/ .
- Logan
--
"In order to be prepared to hope in what does not deceive,
we must first lose hope in everything that deceives."
Georges Bernanos
------------------------------
Date: Fri, 12 Oct 2001 05:44:30 GMT
From: "James" <jthomson110@home.com>
Subject: Larry Wall siting
Message-Id: <2rvx7.54246$kf1.17507403@news1.rdc1.ne.home.com>
Spotted at:
http://216.7.64.15/cgi/fark/comments.pl?IDLink=56369
------------------------------
Date: Fri, 12 Oct 2001 01:05:16 -0400
From: Mike Salib <mmssaalliibb@mmiitt.eedduu>
Subject: Lightweight Languages Workshop, Cambridge MA 11/17/01
Message-Id: <3BC67A0C.3090900@mmiitt.eedduu>
Folks,
The Dynamic Languages group at the MIT AI lab is hosting a workshop on
Saturday, November 17, and you are invited. The workshop will be held at
the AI lab in Cambridge, Massachusetts. It should be lots of fun; We've
already got Shriram Krishnamurthi (scheme), Dan Sugalski (perl6
internals), Jeremy Hylton (python), and Eric Raymond scheduled to
present talks. Here's the info. If this appeals to you, check out our
web site at LL1.mit.edu.
LL1 is a workshop where the world's most innovative language
implementors from industry and most clever language researchers from
academia are coming together to jam for a day. Implementors and
researchers will give short presentations followed by lively
discussions. Everyone is welcome to attend; the workshop is free, but if
you're going to come, you have to register with us first. If you can't
make it to sunny Cambridge, Massachusetts for the day, you can still
watch on our live webcast. This workshop is hosted by the Dynamic
Languages group at the MIT AI Lab.
Many of the most widely used languages to emerge in the last five years
have come, not from the academic programming language research
community, but from industry. Examples include Perl, Python, Ruby, and
Rebol. These languages have borrowed heavily from academic research,
sporting features such as garbage collection and closures, but they also
experiment with many novel ideas, such as first class environments and
keyword-free syntax. In the meantime, academic research has made
substantial progress in formally addressing issues such as safety,
correctness, and also the implementation of seemingly expensive features
such as closures and dynamic dispatch. Lightweight languages have
proven to be the most effective vector for getting innovative language
features into the hands of working programmers.
We use the term "lightweight languages" to describe some of the common
features of these new languages. The term "lightweight" refers not to
actual functionality, but to the idea that these languages are easy to
acquire, learn, and use. Examples that would fall into this category
include Perl, Python, Ruby, Scheme (and scsh), and Curl.
The one day workshop on lightweight languages aims to bring together
implementors from the lightweight language community and researchers
from academia. The hope is that both communities will find it both
enjoyable and enlightening to hear what others are up to. People
involved with implementing the next generation of scripting languages
might find design and implementation ideas from academia, and
programming language researchers can hear about the challenges and
successes involved with producing and maintaining popular lightweight
languages.
The workshop will consist of both prepared presentations and also lively
discussions. Participants are invited to give short presentations of
their work, including their goals, aesthetics, and issues.
Participants will influence what topics we focus on. Some example
topics are: interoperability, RMI, macros, closures, types (static vs.
dynamic), executable invariants and assertions, and dynamic
optimization. Let us know your preferences.
Best Regards,
Mike Salib
(remove the redundant bits in my email address to send mail, or better
yet, just visit the website)
------------------------------
Date: Fri, 12 Oct 2001 05:28:25 GMT
From: kaz@ashi.footprints.net (Kaz Kylheku)
Subject: Re: Lightweight Languages Workshop, Cambridge MA 11/17/01
Message-Id: <Zbvx7.67260$ob.1639020@news1.rdc1.bc.home.com>
In article <3BC67A0C.3090900@mmiitt.eedduu>, Mike Salib wrote:
>Many of the most widely used languages to emerge in the last five years
>have come, not from the academic programming language research
>community, but from industry. Examples include Perl, Python, Ruby, and
>Rebol. These languages have borrowed heavily from academic research,
>sporting features such as garbage collection and closures, but they also
That's borrowing from 40-year-old Lisp features, not from *current*
academic research!
------------------------------
Date: Fri, 12 Oct 2001 08:40:16 +0200
From: Arjen Markus <Arjen.Markus@wldelft.nl>
Subject: Re: Lightweight Languages Workshop, Cambridge MA 11/17/01
Message-Id: <3BC69050.E47906DF@wldelft.nl>
Mike Salib wrote:
>
> Folks,
>
> The Dynamic Languages group at the MIT AI lab is hosting a workshop on
> Saturday, November 17, and you are invited. The workshop will be held at
> the AI lab in Cambridge, Massachusetts. It should be lots of fun; We've
> already got Shriram Krishnamurthi (scheme), Dan Sugalski (perl6
> internals), Jeremy Hylton (python), and Eric Raymond scheduled to
> present talks. Here's the info. If this appeals to you, check out our
> web site at LL1.mit.edu.
>
The other day larry Virden mentioned a poster and paper about a
"data mining" application in Tcl. Actually, it turned out to be
an application of a pseudo natural language processor in Tcl.
Would that be of any interest to the workshop?
The quotation:
"De Clarke did a poster at the 1998 Tcl conference on DataMynah, the
system she developed that dealt with data visualization of the massive
amounts of data that an orbiting satellite was retrieving.
<URL:
http://www.usenix.org/publications/library/proceedings/tcl98/full_papers/declarke_poster/declarke_html/declarke.html
>
Regards,
Arjen Markus
------------------------------
Date: 11 Oct 2001 19:41:50 -0700
From: vadivasbro@hotmail.com (2obvious)
Subject: Need help with a Regular Expression
Message-Id: <6e537be.0110111841.50d54c34@posting.google.com>
I'm trying to write a regular expression that identifies *at least* 2
blocks of alphabetical characters. This is the best that I can do:
/^[A-Z]+\s[A-Z]+$/i
Unfortunately, this only identifies *exactly* 2 blocks of alphabetical
characters. Can somebody help me?
------------------------------
Date: Fri, 12 Oct 2001 12:34:09 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Need help with a Regular Expression
Message-Id: <gYsx7.38$dv.609@wa.nnrp.telstra.net>
"2obvious" <vadivasbro@hotmail.com> wrote in message
news:6e537be.0110111841.50d54c34@posting.google.com...
> I'm trying to write a regular expression that identifies *at least* 2
> blocks of alphabetical characters. This is the best that I can do:
>
> /^[A-Z]+\s[A-Z]+$/i
>
> Unfortunately, this only identifies *exactly* 2 blocks of alphabetical
> characters. Can somebody help me?
Install a repeat block with a minimum of one and no maximum for the block
which would repeat for extra bloacks of text.
/^[A-Z]+(\s[A-Z]+){1,}$/i
This repeats the \s[A-Z]+ at least 1 time and no maximum.
perlre says:
The following standard quantifiers are recognized:
* Match 0 or more times
+ Match 1 or more times
? Match 1 or 0 times
{n} Match exactly n times
{n,} Match at least n times
{n,m} Match at least n but not more than m times
Wyzelli
--
@x='074117115116032097110111116104101114032080101114108032104097099107101114
'=~/(...)/g;
print chr for @x;
------------------------------
Date: Fri, 12 Oct 2001 12:37:35 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Need help with a Regular Expression
Message-Id: <t%sx7.40$dv.604@wa.nnrp.telstra.net>
"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:gYsx7.38$dv.609@wa.nnrp.telstra.net...
> "2obvious" <vadivasbro@hotmail.com> wrote in message
> news:6e537be.0110111841.50d54c34@posting.google.com...
> > I'm trying to write a regular expression that identifies *at least* 2
> > blocks of alphabetical characters. This is the best that I can do:
> >
> > /^[A-Z]+\s[A-Z]+$/i
> >
> > Unfortunately, this only identifies *exactly* 2 blocks of alphabetical
> > characters. Can somebody help me?
>
> Install a repeat block with a minimum of one and no maximum for the block
> which would repeat for extra bloacks of text.
>
> /^[A-Z]+(\s[A-Z]+){1,}$/i
>
> This repeats the \s[A-Z]+ at least 1 time and no maximum.
>
Of course a simpler way (*doh*) would be simply to remove the trailing
anchor...
/^[A-Z]+\s[A-Z]+/i
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
$d='$_$a$s$b$w';$e='$_$a$s$b';sub d{$h=shift;$h=~s/\$(\w+)/${$1}/g;return$h}
sub
e{return(shift!=1)?'s':''}for(reverse(1..100)){$s=e($_);$f=d($d);$g=d($e);
$c.="$f\n$g\n$t\n";$_--;$s=e($_);$e=d($d);$c.="$e\n\n";}print"$c*hic*";
------------------------------
Date: Fri, 12 Oct 2001 03:30:49 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Need help with a Regular Expression
Message-Id: <slrn9scov8.l88.mgjv@verbruggen.comdyn.com.au>
On 11 Oct 2001 19:41:50 -0700,
2obvious <vadivasbro@hotmail.com> wrote:
> I'm trying to write a regular expression that identifies *at least* 2
> blocks of alphabetical characters. This is the best that I can do:
>
> /^[A-Z]+\s[A-Z]+$/i
>
> Unfortunately, this only identifies *exactly* 2 blocks of alphabetical
> characters. Can somebody help me?
Your problem is a bit underspecified.
If all you are interested in is whether the string _contains_ at least
two blocks of alphabeticals separated by whitespace, then just remove
the anchors, or at least one of them.
If what you really want is a string that starts with alphas, ends with
alphas, and has nothing but whitespace and alphas in between, then
maybe
/^[A-Z]+\s[\sA-Z]*[A-Z]+$/
is what you need.
if you really want to insist that the 'blocks of alphabetics' are
separated by exactly one space, then:
/^[A-Z]+\s(?:[A-Z]+\s)*[A-Z]+$/
is maybe more like it.
Note 1: none of the above regexes are tested. Once you specify exactly
what you need, I'll test :)
Note 2: none of the above will work correctly if a locale is in action
that doesn't have all of its alphabetics between A and Z, but neither
did your version.
Martien
--
Martien Verbruggen |
Interactive Media Division | Little girls, like butterflies, need
Commercial Dynamics Pty. Ltd. | no excuse - Lazarus Long
NSW, Australia |
------------------------------
Date: Fri, 12 Oct 2001 03:51:23 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Need help with a Regular Expression
Message-Id: <3BC6693C.CA8769@acm.org>
2obvious wrote:
>
> I'm trying to write a regular expression that identifies *at least* 2
> blocks of alphabetical characters. This is the best that I can do:
>
> /^[A-Z]+\s[A-Z]+$/i
>
> Unfortunately, this only identifies *exactly* 2 blocks of alphabetical
> characters. Can somebody help me?
Remove the anchors.
/[A-Z]+\s[A-Z]+/i
John
--
use Perl;
program
fulfillment
------------------------------
Date: Fri, 12 Oct 2001 03:52:44 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Need help with a Regular Expression
Message-Id: <3BC66992.65F8D163@acm.org>
Wyzelli wrote:
>
> "2obvious" <vadivasbro@hotmail.com> wrote in message
> news:6e537be.0110111841.50d54c34@posting.google.com...
> > I'm trying to write a regular expression that identifies *at least* 2
> > blocks of alphabetical characters. This is the best that I can do:
> >
> > /^[A-Z]+\s[A-Z]+$/i
> >
> > Unfortunately, this only identifies *exactly* 2 blocks of alphabetical
> > characters. Can somebody help me?
>
> Install a repeat block with a minimum of one and no maximum for the block
> which would repeat for extra bloacks of text.
>
> /^[A-Z]+(\s[A-Z]+){1,}$/i
>
> This repeats the \s[A-Z]+ at least 1 time and no maximum.
Which is the same as:
/^[A-Z]+(\s[A-Z]+)+$/i
John
--
use Perl;
program
fulfillment
------------------------------
Date: Thu, 11 Oct 2001 21:23:13 -0400
From: Zimmen Gnauh <yah00204052@yahoo.com>
Subject: open file for appending
Message-Id: <3BC64601.AE46B082@yahoo.com>
I need to open a file for writing if that file does not exist, or open
the file for appending if that file alreadys exist. What's the simplest
statement to do that. It looks neither
open(FILE, ">$file")
nor
open(FILE, ">>$file")
does the job.
------------------------------
Date: Thu, 11 Oct 2001 20:24:12 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: open file for appending
Message-Id: <87wv21slab.fsf@limey.hpcc.uh.edu>
>> On Thu, 11 Oct 2001 21:23:13 -0400,
>> Zimmen Gnauh <yah00204052@yahoo.com> said:
> I need to open a file for writing if that file does
> not exist, or open the file for appending if that file
> alreadys exist. What's the simplest statement to do
> that. It looks neither open(FILE, ">$file") nor
> open(FILE, ">>$file") does the job.
open(FILE, ">>$file") is correct.
The problem is somewhere else. You need to check the
return status of open() to see if it succeeded.
open(FILE, ">>$file") || die "Couldn't append to $file: $!\n";
$! tells you whyit failed (perldoc perlvar).
This is almost certainly a permissions problem (is it a
CGI program by any chance, in disguise?).
hth
t
--
Whoops, I've said too much. Smithers, use the amnesia ray...
------------------------------
Date: Thu, 11 Oct 2001 22:19:07 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Pattern Matching
Message-Id: <3BC6531B.8081B991@earthlink.net>
shaz wrote:
>
> > > I want to test for the occurance of a particular string within a
> > > hash.
> > >
> > > The following was suggested:
> > >
> > > $y_or_n = grep { index($_, $small) != -1 } keys %strings;
> >
> > Umm, whats wrong with
> >
> > $y_or_n = defined $strings{$small};
>
> I want to find the number of times that a substring appears within a
> longer string.
>
> Using the example above:
>
> If $small = "the"
>
> it should match "the end" or "the end of" or "end the book" etc BUT
> NOT "then they" or "there is".
Here's one solution:
my %words;
for( keys %strings ) {
++$words{$_} for split; # you might replace "split" with "/\w+/g"
}
$y_or_n = $words{$small} || 0;
Here's another:
$y_or_n = grep /\b\Q$small\E\b/, keys %strings;
--
"Just how stupid are you Kuno?"
"Verily, Tatewaki Kuno knows no limits."
------------------------------
Date: Thu, 11 Oct 2001 22:14:02 -0400
From: Sean O'Dwyer <notspam@spamfree.dud>
Subject: Perl Power Limits?
Message-Id: <notspam-F2961E.22140211102001@news.compuserve.com>
Hello,
I'm working on a site at the moment that gets approximately 900k hits
and 32k unique visits per month.
There are some aspects of the site that should be databased and I'm
wondering what the real world outside limit for Perl might be: 1,000 SSI
calls per hour, 10,000?
In other words, is this a job for C++ or can Perl handle it with room to
spare? Does my question even make sense?
TIA,
Sean
--
Tanta agenda, tantula voluntas.
------------------------------
Date: Fri, 12 Oct 2001 02:44:02 GMT
From: "Rob - Rock13.com" <rob_13@excite.com>
Subject: Re: Perl Power Limits?
Message-Id: <Xns9137E72D1969rock13com@64.8.1.226>
Sean O'Dwyer
<news:notspam-F2961E.22140211102001@news.compuserve.com>:
> I'm working on a site at the moment that gets approximately
> 900k hits and 32k unique visits per month.
Not really helpful, how many accesses to documents that need to
call Perl?
> There are some aspects of the site that should be databased and
> I'm wondering what the real world outside limit for Perl might
> be: 1,000 SSI calls per hour, 10,000?
>
> In other words, is this a job for C++ or can Perl handle it
> with room to spare? Does my question even make sense?
Doesn't make a whole lot of sense to me, but I'm rather new to all
this Perl stuff:-)
Depending on what you are trying to do I assume the C++ may not be
any faster than the Perl implementation. And the Perl
implementation is most assuredly going to get written faster.
The biggest hangup would be firing up the Perl interpreter with
each SSI (you're talking Server Side Includes right?). So mod_perl
may help since perl doesn't need to start each time.
The speed of your database is going to be an issue as well, maybe
more of an issue?
PHP might be something to look into.
--
Rob - http://rock13.com/
Web Stuff: http://rock13.com/webhelp/
------------------------------
Date: Fri, 12 Oct 2001 03:36:48 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Perl Power Limits?
Message-Id: <slrn9scpag.l88.mgjv@verbruggen.comdyn.com.au>
On Thu, 11 Oct 2001 22:14:02 -0400,
Sean O'Dwyer <notspam@spamfree.dud> wrote:
> Hello,
>
> I'm working on a site at the moment that gets approximately 900k hits
> and 32k unique visits per month.
Not enough information. A 'hit' is a useless metric. Page impressions
is slightly better. For this question, it would really only be
important how many of those would need to be dynamically generated.
> There are some aspects of the site that should be databased and I'm
> wondering what the real world outside limit for Perl might be: 1,000 SSI
> calls per hour, 10,000?
Depends very much on the hardware, doesn't it? And your software
design. And whether you use something like mod_perl or not. And the
OS. And many other things.
> In other words, is this a job for C++ or can Perl handle it with room to
> spare? Does my question even make sense?
I'd say Perl could handle it, but C++ could probably handle it with
lower memory and CPU requirements. On the other hand, the development
cycle would be shorter, and less prone to bugs with Perl.
All of this is assuming that your database isn't going to be the
bottleneck, because if it is, it makes no difference.
A design for a project like this cannot be easily answered on a
newsgroup with no information. It'd take quite some time from a
dedicated person who knows what they're doing, and who has all the
information and requirements of your system
Martien
--
Martien Verbruggen |
Interactive Media Division | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd. | Universe and Reboot +++
NSW, Australia |
------------------------------
Date: Fri, 12 Oct 2001 12:54:36 +0800
From: "Walter Cheung" <cheung_walter@yahoo.com>
Subject: problem on compiling
Message-Id: <9q5tma$kvj5@rain.i-cable.com>
Folks:
I have a question on compiling of Perl. I believe this question has
been posted. But, sorry! I cannot find it.
I am using Linux and I try to compile the Perl. When I do "make test",
I got the following result. Oh!!! I don't know what it means. Can someone
gives me some tips? Thank you...
Regards
Walter
op/misc..............PROG:
# This test is here instead of pragma/locale.t because
# the bug depends on in the internal state of the locale
# settings and pragma/locale messes up that state pretty badly.
# We need a "fresh run".
BEGIN {
eval { require POSIX };
if ($@) {
exit(0); # running minitest?
}
}
use Config;
my $have_setlocale = $Config{d_setlocale} eq 'define';
$have_setlocale = 0 if $@;
# Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1"
# and mingw32 uses said silly CRT
$have_setlocale = 0 if $^O eq 'MSWin32' && $Config{cc} =~ /^(cl|gcc)/i;
exit(0) unless $have_setlocale;
my @locales;
if (-x "/usr/bin/locale" && open(LOCALES, "/usr/bin/locale -a|")) {
while(<LOCALES>) {
chomp;
push(@locales, $_);
}
close(LOCALES);
}
exit(0) unless @locales;
for (@locales) {
use POSIX qw(locale_h);
use locale;
setlocale(LC_NUMERIC, $_) or next;
my $s = sprintf "%g %g", 3.1, 3.1;
next if $s eq '3.1 3.1' || $s =~ /^(3.+1) \1$/;
print "$_ $s\n";
}
EXPECTED:
GOT:
/usr/bin/locale: cannot read locale directory `/usr/share/locale': No such
file or directory
FAILED at test 66
op/mkdir.............ok
------------------------------
Date: Thu, 11 Oct 2001 21:38:16 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Stop Transversal of a Directory with Tar and Unzip
Message-Id: <3BC64988.644194E1@earthlink.net>
Randal L. Schwartz wrote:
>
> >>>>> "BUCK" == BUCK NAKED1 <dennis100@webtv.net> writes:
>
> BUCK> I understand, here's a test that I ran for -x, and it excludes
> BUCK> the files that match the patterns, if I type it like this:
>
> BUCK> `unzip -qjnCL $tmpfile -x "*\.pl" "*readme*" "*\.ht" "*\.exe" -d
$tmpdir 2>&1`
>
> BUCK> The strange thing is that if I break the above into more
> BUCK> readable lines (below), the -x doesn't work. Any idea why?
>
> BUCK> `unzip -qjnCL $tmpfile
> BUCK> -x "*\.pl" "*readme*" "*\.ht" "*\.exe"
> BUCK> -d $tmpdir 2>&1`
>
> Yes, newlines inside of qx// are given as newlines to the shell,
> and that's a statement delimiter!
The correct way to do this from within perl would be:
unless( fork ) {
open(STDERR, "<&STDOUT") or die "Couldn't dup STDOUT: $!";
exec( "unzip", "-qjnCL", $tmpfile,
qw(-x *.pl *readme* *.ht *.exe),
"-d", $tmpdir );
die "Couldn't exec unzip: $!";
}
Note that . is not special inside of a glob, so it does not have to be
escaped.
--
"Just how stupid are you Kuno?"
"Verily, Tatewaki Kuno knows no limits."
------------------------------
Date: Fri, 12 Oct 2001 00:32:07 -0700
From: Amer Neely <aneely@softouch.on.ca>
Subject: Re: Uploading
Message-Id: <3BC69C77.B25B1F56@softouch.on.ca>
peter pilsl wrote:
>
> Amer Neely wrote:
>
> >
> > I would also suggest getting if possible the "Official Guide to
> > Programming with CGI.pm" by Lincoln Stein. It contains good examples of
> > code for uploading files. However, he does state that in some situations
> > it fails, so be aware if this happens and you start pulling your hair
> > out as I did :)
>
> File-upload-fields are part of my daily bread (so you can imagine what
> low-qualitiy-food I eat every day ;), but I never had any problems with em.
> The code I use (mainly from cgi.pm) is fairly simple and robust.
>
> What problems are you talking about ?
>
> peter
>
> --
> peter pilsl
> pilsl_@goldfisch.at
> http://www.goldfisch.at
In his CGI FAQ at
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html#upload_caveats the
very first paragraph in the Upload section reads: "The file upload
feature doesn't work with every combination of browser and server. The
various versions of Netscape and Internet Explorer on the Macintosh,
Unix and Windows platforms don't all seem to implement file uploading in
exactly the same way. I've tried to make CGI.pm work with all versions
on all platforms, but I keep getting reports from people of instances
that break the file upload feature."
I've witnessed some of these failures for a client of mine for which I
provided an upload feature for client resumes. Out of every few hundred
successful uploads we still get the odd failure, and I haven't been able
to isolate or duplicate it. But it sure beats copy-paste your resume
into a text box :) If you haven't had any failures, consider yourself
lucky I guess.
--
Amer Neely aneely@softouch.on.ca
Certified Internet Webmaster Designer
Softouch Information Services: www.softouch.on.ca/
Perl / CGI programming for shopping carts, data entry forms.
"We make web sites work!"
------------------------------
Date: Fri, 12 Oct 2001 04:59:00 GMT
From: Geoffrey Pointer <geoffrey@bigpond.net.au>
Subject: Re: YOU ARE ALL GAY!
Message-Id: <B7ECB739.83A4%geoffrey@bigpond.net.au>
On: Tue, 9 Oct 2001 13:07:09 GMT
Subject: YOU ARE ALL GAY!
dvus <dven1@adelphia.net> said:
> I am neatly moronic, so I kick you. Every robust specialized data havens
> quietly dump as the tall machines question. As fully as Margaret perseveres,
> you can train the gorilla much more cruelly. It vended, you interfaced, yet
> Ophelia never wickedly proliferated inside the sign. She'd rather prioritize
> stupidly than reload with Orin's violent spool. Better disrupt Javas now or
> Sarah will lazily dream them over you. I was opening CDROMs to usable
> Bernadette, who's facilitating to the laptop's contact. Tell Walter it's
> rogue producing to a chatroom. Morris mercilessly closes erect and busts our
> bright, insecure FORTRANs in back of a website. One more ADSLs rigidly roll
> the dry monument. Sometimes, go crawl a pointer! If you'll manage Robette's
> mail server with LANs, it'll actually save the president. Where will you
> prepare the secret useless screens before Ed does? Otherwise the TCP/IP in
> Merl's PGP might smile some overloaded governments. Carolyn, have a
> vulnerable JPEG. You won't disconnect it. Sometimes, Ayn never locates until
> Beth learns the solid Usenet wanly. They are collaborating inside opaque,
> against huge, inside abysmal ActiveXs. Brian doesn't slump hard
> advertisements, do you filter them?
I commented on this as follows:
> It's funny about that isn't it? Go figure.
Other stuff was said in between and I commented further:
> I realise now how saying too little can sometimes be misconstrued.
Ahmen to that!!
Then on: Thu, 11 Oct 2001 19:03:03 +0900
tm <tmoero@yahoo.com> said:
> hey geof,
> What are you mumbling about?
> Who are you mumbling at?
> Look, if you want to be taken seriously on usenet, read this-
> http://www.geocities.com/nnqweb/nquote.html
>
> See if that info will sink into your peabrain. If not, go mumble in some
> other ng.
> Thanks,
> TM
Okay. My message subject was
Subject: Re: YOU ARE ALL GAY!
So my pea brain tells me I was commenting on
Subject: YOU ARE ALL GAY!
Which is still current round and about.
If _you_ want to be taken seriously maybe you should take your finger off
your hair trigger and lay your gun to rest somewhere more suitable.
On: Thu, 11 Oct 2001 16:29:02 +0100
nice.guy.nige said:
> If that is the case, then it would have been a good idea to include some of
> the original message that you were replying to, so the context of the
> conversation wouldn't be lost. I have not seen the original message - just
> your reply - and as such your post made absolutely no sense whatsoever.
Thanks Nigel, I realise my error and you have clearly demonstrated that
education doesn't have to be a humiliating experience. Heck, I know I'm not
perfect.
I made an offhand comment about a truly weird and wonderful message, the guy
is obviously a poet or something, which I will continue to regret for some
time. Yeah, like hell I will ;-)
-- Cheers - Geoff %^>
Frank Zappa: Yes Virginia ... there is a free lunch.
We are eating it now. Can I get you a napkin?
------------------------------
Date: Fri, 12 Oct 2001 14:48:34 +0900
From: tm <tmoero@yahoo.invalid>
Subject: Re: YOU ARE ALL GAY!
Message-Id: <tmoero-733FD3.14483412102001@newsflood.tokyo.att.ne.jp>
Geoffrey Pointer wrote:
> tm said:
>
> > hey geof,
> > What are you mumbling about?
> > Who are you mumbling at?
> > Look, if you want to be taken seriously on usenet, read this-
> > http://www.geocities.com/nnqweb/nquote.html
> >
> > See if that info will sink into your peabrain. If not, go mumble in some
> > other ng.
> > Thanks,
> > TM
>
> Okay. My message subject was
>
> Subject: Re: YOU ARE ALL GAY!
>
> So my pea brain tells me I was commenting on
>
> Subject: YOU ARE ALL GAY!
>
> Which is still current round and about.
>
> If _you_ want to be taken seriously maybe you should take your finger off
> your hair trigger and lay your gun to rest somewhere more suitable.
>
Much better geof, you left the attributes this time. Shows you are
capable of learning. You could use some help with snipping, but keep up
the good work.
Say, would you like to learn how to make a proper sig delimiter?
------------------------------
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 1916
***************************************