in reply to Dereferencing arrays
Try this:
use Data::Dumper; print Dumper($nextimg); [download]
and see if that helps to explain things a little.
update: My guess is
--MidLifeXis