As an example of Grandfather's comments about $#array and its value for an empty array, and as a duplication of the specific error message you are getting:
perl -wMstrict -e "my @bids = (); chomp($bids[$#bids])"
Modification of non-creatable array value attempted, subscript -1
at -e line 1.