Memory is cheap and a common Perl trick is to trade memory for performance - but how do you know how much memory a data structure is using? With Devel::Size and Number::Bytes::Human:
warn '$photos takes up ' . format_bytes( total_size($photos) ) if $DEBUG;
This outputs something like:
$photos takes up 2.3M
2.3M! That's so small, I can easily stick a hundred times more photos in there before worrying about memory usage. I'll go add some more functionality instead of prematurely optimising...