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

Re: [FWP] Sideways Perl



sideways perl should augment the very useful swap perl nicely.

swap perl:
----------------------------------------
#!/usr/bin/perl
use strict;
my (@l, @m, $i);

while (<>) {
   chomp;
   @l = split('');

   for ($i = 0; $i < @l; $i+=2) {
      ($l[$i], $l[$i+1]) = ($l[$i+1], $l[$i]);
   }

   push (@m, join('', @l));
}

eval join ("\n", @m);
----------------------------------------

swap perl sample:
----------------------------------------
su etsirtc;
ym( l@ ,m@ ,i$;)

hwli e<()>{
  c ohpm;
  @  l =psil(t'';)

  f ro( i$= 0  ;i$< @ ;l$ +i2= ){
      $([li$,]$ [li$1+)]= ( l$$[+i]1 ,l$$[]i;)
  }

  p su h@(,mj io(n'' ,l@));
}

velaj io n"(n\,"@ )m;
----------------------------------------

hTnask,
dEP reyr


> Perl is great.  However, I'm sure that all of you have been annoyed at the
> fact that it forces you to write from left to right instead of top to
> bottom.
> 

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