|No such thing as a small change|
Re: Making Cue Scripts with Perlby GrandFather (Cardinal)
|on Dec 17, 2012 at 22:14 UTC||Need Help??|
Don't initialise all your variables in a great bolus at the top of your code. You wipe out half the advantage of using strictures if you do so. Instead declare and initialise variables to have as small a scope as makes sense. Always initialise variables with their first value when they are declared unless the declaration must be outside a loop.
is much better written:
New acts and scenes are better managed by:
Don't use manifest constants ("true" and "false") for boolean values. They are prone to error and obscure the flow of the code by adding code. if ($new_scene) is easy to read an understand - anything more is harder to read, understand and get right.
Use three parameter open and lexical file handles:
Note that your open (open PLAY, $mit_shakes || die "Could not open file: $!\n";) is broken. Replace || with or for it to work as you expect.
True laziness is hard work