www.stonehenge.com (fwd)
Brent Fulgham
brent.fulgham at xpsystems.com
Thu Aug 31 11:42:11 CDT 2000
Gary,
You have VERY strong Kung Fu.
(continued)
> SPOILERS below, so don't read if you want to try to figure
> Randal's code
> out yourself!
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Interesting...
>
> Randal's code is
> my @column_def = map [ m{^(\S+)\s+(.*)} ], <<'END_DEFINITION' =~
> /(.+)/g;
>
> followed by a here-document containing lines like
> Name perl-mongers group name
>
> I might have written it as
> my @column_def = map [ split ' ', $_, 2 ], split /\n/,
> <<'END_DEFINITION';
>
> This seems a lot clearer to me. I think it's the same result
> (it looks the same when I print it). But TMTOWTDI, of course!
>
> The only part of Randal's code that I would call _really_ obscure
> is the /(.+)/g at the end.
>
The funky "<<'END_DEFEINITION' " construct is something I usually
associate with shell scripts. It seems like pre-defining the
hash might have been clearer, but I guess this way he only had to
fill out the list one time and it generates both the columns array
and the hash table... Interesting.
-Brent
More information about the Thousand-oaks-pm
mailing list