On Jan 25, Dave Rankin said:
>be a bad approach. Here's the code I came up with:
The "best" approach is to use a hash, since it is optimized for making
sure its keys are unique.
>my $matches; ## running with "use strict;"
>while (<>) {
> while (/(\w+)/ig) {
The /i isn't needed, since \w
Hi Everybody,
I'm working through the "Mastering Regular Expressions" book right now, so
after reading the question earlier this week about finding the number of
unique words in some input and the really great responses everybody sent, I
wondered if I couldn't think of another way to do this (
On Jan 22, Frank said:
>On Tue, Jan 22, 2002 at 12:47:02PM -0500, Jeff wrote:
>> [Peter: what does "Aspirat primo Fortuna labori" mean? I've gotten a
>> partial translation, but I'm not satisfied with it.]
>
>It means "Fortune favours your first effort".. Mia Culpa
s/Mia/Mea/, I think. Thanks
On Tue, Jan 22, 2002 at 12:47:02PM -0500, Jeff wrote:
> [Peter: what does "Aspirat primo Fortuna labori" mean? I've gotten a
> partial translation, but I'm not satisfied with it.]
It means "Fortune favours your first effort".. Mia Culpa
> Yours does not match the same "words", though. Peter's
[Peter: what does "Aspirat primo Fortuna labori" mean? I've gotten a
partial translation, but I'm not satisfied with it.]
On Jan 22, Frank said:
>On Tue, Jan 22, 2002 at 07:39:31AM -0800, Peter wrote:
>>
>> $word{$_}++ for /(\w+)/g;
>
>Not to forget Perls default settings for split (
On Tue, Jan 22, 2002 at 07:39:31AM -0800, Peter wrote:
> If we accept the set of word characters as being defined by \w, your
> problem can be solved with this code:
>
> my %word;
> while (<>) {
> $word{$_}++ for /(\w+)/g;
> }
---end quoted text---
Not to forge
Wow -- that is really cool. I am going to go review hashes. How crazy
compact!
thanks a lot,
Tim
-Original Message-
From: Peter Scott [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 22, 2002 9:40 AM
To: Booher Timothy B 1stLt AFRL/MNAC; '[EMAIL PROTECTED]'
Subject: Re: C