I think that with $html->find(div.divname)
you mean $html->find('div.divname')
...
The the divname part reflects the div's class name, not its name.
DOM element names actually may not contain spaces. Neither may their class names, as a space has a very different meaning there.
Technically you can do something like $html->find('div[name=foo bar]')
for the name. Or $html->find('div[class=foo bar]')
for the class name. But this will treat your attribute as literal, and will not cascade class names. So this is very bad practice and you shouldn't do it.