Keep It Simple, Stupid | |
PerlMonks |
finding next key in db_fileby Anonymous Monk |
on Aug 16, 2006 at 03:42 UTC ( [id://567592]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Here's my scenario: I am building an image viewer and I have a DB_File db with a numeric key and an image URL for the value. I am going to have a NEXT and LAST link which will be a link that looks like $script.pl?img=100. Now if we were on image 100, the LAST would be 99 and the NEXT would be 101. Some images will be removed which means image 101 might not be there anymore. I need to find a way to make it loop until it finds the NEXT available key backwards and forwards with missing ones in mind. In this example, if we were on image 100 and 101 was missing, it'd check to see if 102 existed, and 103.. On the same token, how would I determine if a key is the last one I have? Say there's 500 images, how would I check to make sure image 500 has no images after? Thank you for your wisdom
Back to
Seekers of Perl Wisdom
|
|