There are a couple issues. One is that you had references and you treated one as a hash. Also, I think you meant "key" when you used $key (of course, if $key eq "key"...).
This code seems to work.
use strict;
use warnings;
{
foreach my $datum (@{$var1->{"key"}->{"data"}->[0]})
{
print "$datum\n";
}
}