Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Display all images in a given directory

by gav^ (Curate)
on Feb 02, 2002 at 03:55 UTC ( [id://142865]=note: print w/replies, xml ) Need Help??


in reply to Display all images in a given directory

Some random points:
  • Why assign "0" to $count instead of 0?
  • grep is your friend: my @files = grep { /\.(?:png|gif|jpg)$/ } readdir DIR;
  • Why use CGI's HTML code, but then don't use it to write the images?

gav^

Replies are listed 'Best First'.
Re: Re: Display all images in a given directory
by cjf (Parson) on Feb 02, 2002 at 04:22 UTC
    Thanks for the pointers :)

    I like your grep method far better. As for using the one here document I did that because I thought there were problems with quotes if I use the CGI.pm print $q->p("") method. In hindsight I'm sure there is a way around this (do I even need the quotes in the cgi print method?).

    Update jarich pointed out a nice way to use CGI.pm to to print out the paragraphs. I've included that in the code now.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://142865]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-19 20:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found