[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] 4 Consecutive Letters



On Mon, Aug 14, 2000 at 12:18:08PM -0500, Greg Bacon wrote:
> In message <20000814122348.C601060@linguist.dartmouth.edu>,
>     Ronald J Kimball writes:
> 
> : You study $word, but your target string for the matches is $a.
> 
> Doh!  That should probably be C<study $a>, but I wonder whether it
> would help.

Unless you had a reeeeally long word without any matches, I'd say probably
not.  :)


> : Two maps are no better than one:
> : 
> : map {'$a =~ /' . substr($word, $_, $cnt) . '/'} (0 .. length($word)-$cnt);
> 
> Touche.  Rosler will nail you for using the slower map BLOCK form. :-)

Oh well, I thought it was more readable that way.


> : Using a constant string for the target and the input for the regex is a
> : neat idea.
> 
> I got it from tchrist on #perl when someone asked how to determine
> whether a number is a string of consecutive digits.
> 
> :             In this case it means a lot of evalling, though...
> 
> How so?

Assuming you were looping over a word list, I mean.  One eval per word.
Just once per subroutine call, though.  :)


Ronald

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe