This is something fairly basic, but I haven't seen it in discussion or in
the RFCs.  If I've missed it, my apologies.

In Perl 5, when a variable is created, it is given the "undefined" value.
This can lead to lots of spurious "Use of uninit'd variable" warnings.

Suppose you could specify the value with which all variables in the
enclosing scope should be initialized; for example:

        { 
        # handle pensioners here
        init_vars = 0;
        my ($num_pensioners, $base_pension, $years_service); # all get '0'
        }

        {
        init_vars = 'ERROR::NAME_NOT_FOUND';
        my ($name_1, $spouse_name_1); # all get 'ERROR...' message
        }

        {
        init_vars = (1,7,9);
        my (@blarg);
        }

        {
        init_vars = \{};
        my ($rh_data_record);
        }

        ...etc


An example of when you might use this is when working with a
DB...frequently, I do the following:
        1) Set up a large number of variables
        2) Put sentinel values in them
        3) Fill them with info from the DB
        4) Check to see if the sentinel value are still there
        5) If so, do error handling


                                Dave

Reply via email to