I forgot to add what I have done so far. I did:
#!/usr/bin/perl
use strict;
use warnings;
my @array = (5,3,2,1,4);
my $n = @array;
for my $i (0 .. $n-1) {
for my $j (0 .. $n-1) {
if ($array[$j+1] $array[$j]) { #compare the two neighbors
$tmp = $array[$j]; # swap
On Tuesday 03 July 2007 10:43, Amichai Teumim wrote:
I forgot to add what I have done so far. I did:
#!/usr/bin/perl
use strict;
use warnings;
my @array = (5,3,2,1,4);
my $n = @array;
for my $i (0 .. $n-1) {
for my $j (0 .. $n-1) {
if ($array[$j+1] $array[$j]) { #compare
On Tuesday 03 July 2007 11:55, you wrote:
OK. So I remove temp and I get this:
Use of uninitialized value in numeric lt () at ./obj8-2.pl line 11.
Use of uninitialized value in numeric lt () at ./obj8-2.pl line 11.
Use of uninitialized value in numeric lt () at ./obj8-2.pl line 11.
Use of