in reply to Barewords and equality tests

SERVICE_STOPPED and SERVICE_STARTING may be constants:

use strict; use warnings; use constant SERVICE_STARTING => 1; use constant SERVICE_STOPPED => 0;

Constants in Perl are just a sort of subroutine with special optimizations. Thus, they follow subroutine syntax rules. We don't get concerned when we see 'shift' as a bare word.


Dave

Replies are listed 'Best First'.
Re^2: Barewords and equality tests
by punkish (Priest) on Dec 29, 2004 at 22:56 UTC
    Thanks (to all). Time for me to read use constant and use vars, some of the many Perlthings that I have not yet used in my past 3-4 years experience with Perl.

    However...

    We don't get concerned when we see 'shift' as a bare word.
    I guess I didn't get bothered by that because shift is a core function in Perl, and it is used on an array. Only when the array is a special variable (@_) we can eliminate it and just type shift() or even shift. Personally, I like using all the parens and spell things out wherever possible. Makes code easy for me.

    Thanks for the clarifications.