I tried your script and it seems to produce nice output however it's possible to break it. In
sub learn files: my $file_info = stat($File::Find::name);
$dirs{$File::Find::dir}{size} += $file_info->size;
you don't check the return status of stat. If $File::Find::name is a broken link, stat may fail (it does on my system) and you get the following error:
Can't call method "size" on an undefined value at ./files.pl line 50.
As a general rule of thumb, you should
always check the return value of things that might fail (which includes almost any call related to the file system). It might also be possible to break this with a race condition where $File::Find::name was deleted prior to the stat.