in reply to Re: Re: Changing a varaibale name within the program?
in thread Changing a varaibale name within the program?

Perl arrays start with an index of 0. That is, the first element of @items can be accessed as $items[0]. Adding a blank element to the start of the array means that if the user requests file 1, you can just say @user_files[$choice] instead of $user_files[$choice - 1].

I'd rather do $choice - 1, but either way, add a comment to the code noting your choice and why you're doing it:

# @user_files starts at zero, user choice starts at 1 process($user_files[$choice - 1]);
That'll make life much easier for the maintainer.

Replies are listed 'Best First'.
Re: Re: Re: Re: Changing a varaibale name within the program?
by Dalin (Sexton) on Jun 27, 2001 at 00:43 UTC
    Thanks guys. I'll try this out as soon as I can. Pesky job gets in the way of coding. I'll let you know how it goes. Thanks again. Bradley
    Where ever there is confusion to be had... I'll be there.