http://qs321.pair.com?node_id=459287


in reply to "Scalar found where operator expected", references

You need a comma between the array and the scalar:

push @weighted, $key;