[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Error!



On Mon, 11 Dec 2000 19:57:23 +0000, Amitava Basu wrote:

>The syntax shows okay.  But when I run the script I get the
>following error.  It has something to do with "my" declaration.
>
>Thank you for the help.
>
>
>Amitava Basu
>
>###########################################################
># "my" variable $alias masks earlier declaration in same scope.
>File 'LC 2:MacPerl ƒ:script.pl'; Line 251

(etc.)

Yes. The script contains several lines like this one:

> my ($alias, $email, $bid, $time, $add1, $add2, $add3) =
>&read_bid($bids[0]); # read first bid

and 

> my ($alias, $email, $bid, $time, $add1, $add2, $add3) =
>&read_bid($bids[$#bids]); # read last bid

All of these are in the main body of the script. Therefore, their scopes
overlap.

Either put these and the following lines in their own block, like this:

   {
       my ($alias, $email, $bid, $time, $add1, $add2, $add3) =
         &read_bid($bids[$#bids]); # read last bid
     ... # everything that references these variables
   }

Or drop the "my" for every line where you get such a warning.

-- 
	Bart.

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org