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

Re: [jeffp@crusoe.net: [FWP] string evenness]



On Dec 1, yanick1@sympatico.ca said:

>sub y2 {
>	my ($string, $l, $x, $y ) = ( shift );
>	$l = length($string) / 2;
>	 $y = $x while ($x = index( $string, ' ', $x+1 )) < $l;
>	 $y = $x if $x + $y < 2 * $l;
>
>	substr $string, $y, 1, "\n";
>	$string;
>}

Oh, I knew there were faster ways to do it without a regex, but regexes
are universal fun. ;)

-- 
Jeff "japhy" Pinyan     japhy@pobox.com    http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource  (my id:  PINYAN)       http://search.cpan.org/
PerlMonks - An Online Perl Community          http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc.   http://www.perlarchive.com/


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