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

Re: [FWP] Sideways Perl



On Oct 11, Tushar Samant explained earnestly:

> >Whoops.  It just goes to show that in Perl, you should always check to see
> >if something has been done.
> 
> No, the rule is to reinvent always, but do it in a cruder and more baroque
> way. Here's an old piece of code--I *think* it works ...
> 
>   for (@l = map {chomp; $m = length if $m < length; $_} <>) {
>     undef substr($_.= " "x$m,$m)
>   } print map reverse."\n", reverse map {join "", map chop, @l} 1..$m
> 
Hmm... that does bottom-up transliteration(?), if you see what I mean.
Here's a not-very-well understood fix ;-)

  for (@l = map {chomp; $m = length if $m < length; $_} <>) {
    print undef substr($_.= " "x$m,$m)
  } print join "\n", reverse map {join "", map chop, @l} 1..$m 

Ciao

--
+======================+======================================
|Zak McGregor	       |	  satisfaction guaranteed
|Infoline South Africa |	  or you are one picky bastard	 
+======================+======================================


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