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
In reply to Why doesn't this code run? by WizardOfPerl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |