my $num_elements = scalar(@molecules); for (my $i = 0; $i < $num_elements; $i++) {