Gan Uesli Starling wrote:
> 
> I get this complaint from 'use strict';
> 
>  > Bareword "ckKeyBts" not allowed while "strict subs"
>  > in use at gus_perl/FYBB_DirTree.pm line 425.
> 
> I know what it means. I have a sub which is defined
> later in the script than it is called on line 425.
> 
> After I put an ampersand onto &ckKeyBts at line 425
> strict stopped whining.

It is better to put parenthesis after the name: ckKeyBts()

The perlsub document explains the difference and why this is better:

perldoc perlsub


> My question is: what happens when this is the case?
> Does Perl, on encountering this former bareword with
> ampersand now attached, execute the sub which
> is later defined, or does something less desireable
> happen?

If you define the sub before you use it then barewords are fine:

sub ckKeyBts {
    # do something
    }

ckKeyBts;  # bareword works ok


Or you could declare the subs at the top of the program and define them
later:

sub ckKeyBts;  # declare that this will be defined later

ckKeyBts;  # bareword works ok

sub ckKeyBts {
    # do something
    }



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to