in reply to Create Hash from array structure

Here's my take. Modifiying it to read input from a file or for pretty printing is left as an exercise.

#!/usr/bin/perl use Data::Dumper; my @students = qw { Thomas 60 10 20 85 Samuel 35 90 80 65 Adam 100 90 85 52 }; my %h; while ( my ($student, @vals) = splice @students, 0, 5) { $h{$student} += @vals[$_] * (0.2, 0.25, 0.25, 0.3)[$_] for 0..3; } print Dumper \%h;

Regarding the code provided by you: one hint - split / / is not probably what you want. Try split // (and see perldoc -f split). Another hint - there are at least three more obvious logical mistakes (...hash keys(mental confusion)...two issues with contents of @students (forgot about references, extra element, again confusion)...) .