davidbrit2
Licensed Computer Geek
See if you can figure out what my program does: (Specifically, HOW it does it)
After you've done that, see if you can do it in fewer characters.
I need to stop hanging around comp.lang.perl.misc. It's obviously affecting my sanity.
Code:
#!/usr/bin/perl -w
@d=@ARGV;sub s{my($f,$l)=@_;if($f<$l){&s($f,my($m)=int(($f+$l)/2));&s($m
+1,$l);@c=();@_=(@d[$f..$m],reverse@d[$m+1..$l]);while(@_){push@c,($_[0]
<$_[-1])?shift:pop}@d[$f..$l]=@c}}&s(0,@d-1);print"@d\n";
After you've done that, see if you can do it in fewer characters.

I need to stop hanging around comp.lang.perl.misc. It's obviously affecting my sanity.