|
#!/usr/bin/perl
my @s=();
for(my $i=1;$i<=10;$i++) { push(@s,$i);}
foreach $n (unsort(@s)) { print "$n "; }
sub unsort { my @s=@_;
if($#s<2) { return @s;}
my (@a,@b,@c)=();
while(@s) {
push(@a,shift(@s));
if(@s) { push(@b,shift(@s));}
if(@s) { push(@c,shift(@s));}
}
return(unsort(@a),unsort(@c),unsort(@b));
}
---------------------------------------------------------------------------------
my @s=();
foreach $f (@ARGV) {
open(I,"$f");
push(@s,<I>);
close(I);
}
foreach $l (unsort(@s)) { print $l; }
|
|