in reply to 'defined' function

This should do it:
# Test me - i do not have the data. my $string; for (7..13) { next unless defined $peaks[$_]; $string = join ' ', $string, $peak[$_]; } push @points, $string;

--tidiness is the memory loss of environmental mnemonics