"... foreach(1..$total_elements){ print "\t\[$_\] my $input[$_ - 1 ]\n"; } ...Why did scalar $input in the foreach loop "works" without predeclaring it with my?" --Eri
HI Eri, The my is probably not doing what you think it is. Otherwise it would constitute a redeclaration error. My guess is that you are creating an implicit anonymous scalar here: print "\t\[$_\] (my $Phantom_scalar = $input[$_ - 1 ])\n"; You dont need to do this. Perl should interpolate the element directly. An underlying issue here is that you are using foreach to do the work of for. The for function is designed to work on indices. Use foreach to work on the elements directly, without reference to their indices. my $element; for (1..$total_elements){ print "\t\[$_\] my $input[$_ - 1 ]\n"; } Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]