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

Re: [FWP] Fun With Golf



Joshua Schulz wrote:
> 
> sub fifth_word{@a=split(/ /,$_[0]);$a[4]}


Csaba Raduly wrote:
> 
> I can't understand half of what's going on in FWP, but this "hole" looks so
> simple...
> 
> sub fifth_word{$_=shift;(split)[4]}

As explained already -- the words are not necessarily delimeted by
whitespace (\s+).  In fact, they are delimited by non-word chars (\W+).

You guys have both sliced *over* the rough onto another fairway!

-- 
John Porter


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