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.pl

Please don't roast me too hard


In reply to Why doesn't this code run? by WizardOfPerl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.