WizardOfPerl has asked for the wisdom of the Perl Monks concerning the following question:
For the last couple of days, I've been writing my first project in Perl.
A program that takes an array, bubble sorts through it's elements and
returns it with the contents in alphabetical order. I've been successful
so far, but the loop that actually bubble sorts through the array just
skipped altogether when run, with no errors.
-
I don't know why, I just want it to be fixed!
-
Here's the code. Please note that I know that the code is messy and
I know that the code could be written much more efficiently, but for
the moment, I just want it to be operational.
-
Here's the crucial bits:
# About halfway through the file my $alphabet = " abcdefghijklmnopqrstuvwxyz"; # Some more variables being defined here that I've left out my $alphabetised = "1"; until ($alphabetised = "1"){ # No code here, but when tested, it doesn't run until ($x >= (scalar @startingArray) - 1) { # minus 1 is necessary # etc etc etc this code doesn't run }; };
-
Please check the full code out here, yes it might give you eye cancer
https://raw.githubusercontent.com/IronGhost645/alphabetiser/master/alphabetiser.plPlease don't roast me too hard
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why doesn't this code run?
by LanX (Saint) on Jun 03, 2017 at 17:16 UTC | |
by WizardOfPerl (Novice) on Jun 03, 2017 at 17:21 UTC | |
by AnomalousMonk (Archbishop) on Jun 03, 2017 at 17:36 UTC | |
by WizardOfPerl (Novice) on Jun 03, 2017 at 20:40 UTC | |
by Anonymous Monk on Jun 06, 2017 at 14:54 UTC | |
by LanX (Saint) on Jun 03, 2017 at 17:27 UTC | |
|
Re: Why doesn't this code run?
by dbander (Scribe) on Jun 04, 2017 at 01:07 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |