in reply to Accessing values of a Hash object
Change $arg=<stdin>; to chomp($arg=<stdin>);
Ref: chomp, IO Operators
Update: Oh and change print $arg; to return $arg;