in reply to Re: Creating variables while using 'strict'
in thread Creating variables while using 'strict'

I thank you for the time you put into responding to my problem. The article you recomended certainly highlights a serious problem with using '$$variable'.

re: para2... I need the loop because I am testing and resetting the data depending on what is submitted, but thanks for the tip.

As to the rest of your comments, the code was there in an atttempt to highlight what I was trying to do. I know it's messy and I don't use variable names like those shown in those examples. I had preciously asked the question about declaring groups of variables but got no response. I had seen my ($firstvar, $secondvar, $thirdvar) used on this site and thought it was correct. I'll use our ($firstvar, $secondvar, $thirdvar) in future!

Example 3 is a messy attempt (that works) to get my $fieldname = $q->param('fieldname') for each field in the HTML doc while also checking and resetting the data within the loop. I didn't like it either.

Anyway, based on the responses above and your comments, I propose the use a hash as in example 4.

  • Comment on Re: Re: Creating variables while using 'strict'

Replies are listed 'Best First'.
Re^3: Creating variables while using 'strict'
by diotalevi (Canon) on Jan 06, 2003 at 07:14 UTC

    The hash is mostly ok except for the issue I raised with wantarray() in the code I posted at the bottom. You could of course just steal that sub and get something that Just Works. (not that I tested it or anything but it looks right)


    Fun Fun Fun in the Fluffy Chair