>>>>> "Bart" == Bart Lateur <[EMAIL PROTECTED]> writes:

Bart> On Mon, 25 Sep 2000 13:00:58 +0200, Henrik Tougaard wrote:
>> Are the counts stuffed in the array in the order they appear in the
>> tr-string? or in ascii-order? or whatever?

Bart> In the same order as they are in the tr/// string, of course.

Bart>   @freq{'a' .. 'z', '0' .. '9'} = tr/a-z0-9//;

That's messy when you are using /c.  What if you wanted the counts
of everything that wasn't a digit for error reporting?

   @freq{ ... what ... } = tr/0-9//c;

You can count them now, but with this new proposal, you'd not know
which you are counting.


Bart> That just won't work. The original proposal will however (or at least I
Bart> can't find any obvious blunders)!

Bart> The hidden flaw is that it will be FAR slower than the original tr///,
Bart> because it needs to search for the hash key for every single matching
Bart> character it finds. Plus, in Perl 5, NO core function returns a hash.
Bart> None at all.

It's not returning a hash.  I like the proposal that has it return a
paired list, similar to the semi-paired list we get with a capturing
split, or a list-context m/()()/g match.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to