in reply to SOLVED - Can't modify private array in division (/) at lib.pl line 31, near "2;"

Here is a corrected version of your loop in calcarr. You might like to reread a chapter about perl arrays because it looks like you have some wrong notions about them

# my @funcArr = 0; my @funcArr= (); #this is how an array can be initialized to be empt +y foreach my $line (@funcArray) { # @funcArray /= 2; $line/= 2; #$line is aliased to each value of the array in the +loop push(@funcArr,$line); }
  • Comment on Re: Can't modify private array in division (/) at lib.pl line 31, near "2;"
  • Download Code

Replies are listed 'Best First'.
Re^2: Can't modify private array in division (/) at lib.pl line 31, near "2;"
by chromatic (Archbishop) on Apr 09, 2009 at 08:40 UTC
    my @funcArr= (); #this is how an array can be initialized to be empty

    That line of code does nothing at runtime, except take up time doing nothing. Arrays start out initialized as empty.