http://qs321.pair.com?node_id=596801


in reply to Music: Calculate Chord Progression Triads

Sadly, I never took up a musical instrument, something I now regret very much. I wonder if it is too late to do so now that I am in my fifties.

Moving back to Perl, I would just like to bring the qw{ ... } construct to your attention, which could save you some typing when setting up your arrays. Instead of

my @notes = ('C', 'C#/Db', 'D', 'D#/Eb', 'E', 'F', 'F#/Gb', 'G', 'G#/Ab', 'A', 'A#/Bb', 'B');

you could do

my @notes = qw{C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B};

And one slight niggle. You use meaningful variable names throughout your script except for the my $i = shift;. It seems a shame to make this omission when the rest of the script is so very clear.

I hope this is of interest.

Cheers,

JohnGG