It doesn't work because you g'get' returns a list. If you evaluate that in scalar context you get the number of elements.
Use wantarray to check for the context:
{ my @store;
sub put {
@store = @_;}
sub get {
return wantarray ? @store : $store[0]; }}