SPUG: Sort an array question
spug at ifokr.org
Thu Dec 26 16:27:17 CST 2002
> While attempting to gain more meaninful employment, I
> happened upon this question from a prospective
> provider of opportunity. "Sort an array
> alphabetically without using the Perl sort command."
> This was provided by someone not familiar with Perl
> but other languages and all work was shown on a white
> board. I think I did OK, there were a few holes in
> the code, and I decided to really give it a shot.
> This works and is very close to what I provided on the
> If any of you have some free time and thoughts, I'd
> appreciate them! Tell me what you think.
Though you could certainly code up a bubble/insertion/quick sort
or such, how 'bout
my @array1 = qw(e c g h z r t a i h j l p b d r q x v a);
open2(*R, *W, "sort") or die "Can't run sort!":
print W join "\n", @array1;
chomp(@array2 = <R>);
print "Sorted version: @array2";
After all, TMTOWTDI.
Brian Hatch Each generation has
Systems and it's signaure disease.
Security Engineer The Black Plague.
http://www.ifokr.org/bri/ Cholera. Ebola. AIDS.
Every message PGP signed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 240 bytes
Desc: not available
Url : http://mail.pm.org/archives/spug-list/attachments/20021226/fec1bff1/attachment.bin
More information about the spug-list