syntax error at ./test.pl line 3, near "$v{u"
The reason the this is a syntax error is that you cannot declare one element of an array or hash with my.
Athanasius has already given you great examples of working code.
To add...Perl has three basic data types: scalars, arrays and hashes:
scalars hold a single value and are of the form $scalar
arrays hold an ordered list of values and are accessed individually as $array[n] where n is the index in the list. They are accessed as a whole list using @array
finally hashes are unordered lists accessed by a key. Individually they are $hash{key} and as a complete hash with %hash.