Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use a number of random images to display on a page.

Status
Not open for further replies.

Knexo10

IS-IT--Management
Feb 12, 2002
20
AU
I have a web page that I want to have loaded up to display with ten random pictures and corresponding descriptions around the logo of the site.

I want to have these pictures picked out of a list of about 30 different pictures.

I have my pictures names, paths, and Descriptions stored in a txt file that I update.

What would the best way to build this page using perl? Do I read my text file and create an array with all the available pictures names in it and then run some sort of random way of selecting a picture form that array?

I would need a way that would only pick pictures that had not already been picked.

I just need out some suggestions for this kind of operation before I start.

Also sample code would be nice.
 
# data:
name|paths|Descriptions
# idea:
# perlpath
#...
open DATA, &quot;<$datapath&quot; || die &dead;
@stuff = <DATA>;
close DATA;
$counter = 0
foreach $line (@stuff) {
if ($line == $wanted) {
push(@newstuff,$line)
}
$counter++;
}
# ... helping ?

someone knowledge ends were
someone else knowledge starts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top