I am fairly new to PERL. I have this code that searches a directory called /webpics which contains like several other subdirectories. How do I recursively search these. below is what I have. it only works for one subdirectory in the directory /webpics.
#!/usr/bin/perl -w use CGI; use strict; use product qw(:productInfo); use Cwd; $|++; my $q = new CGI; my $sku = $q->param('sku'); my $path_to_images = "/webpics/originals/"; my $path_to_images = "/webpics/itemthumb/"; my $path_to_images = "/webpics/itemmed/"; print $q->header(); #check for sku, description associated with it #then print the image if ($sku){ my $firstDigits; if ($sku =~ /^\d{3}/) {$firstDigits = $&} my %product = getProductInfo($sku); $path_to_images .= $firstDigits . "/" . $sku . ".jpg"; if (-e $path_to_images && values %product) { print <<HTML; <center> <table width="200" border="1"> <tr align="center" valign="middle"> <td> <img src="/webpics/originals/$sku.jpg"> </td> <td> <img src="/webpics/originals/$firstDigits/$sku.jpg"> </td> <td><img src="/webpics/itemthumb/$firstDigits/$sku.jpg"></td> </tr> </table> <table width="400" height="100"> <tr> <td align="left"> Sku Number: <b>$sku</b><br> Item Number: <b>$product{'item_number'}</b><br> Minimum Sell: <b>$product{'min_amount'}</b><br> Description: <b>$product{'description'}</b><br> Retail: <b>\$$product{'retail'}</b><br> </td> </tr> </table> </center> HTML } else{ print <<HTML; <center> <font color="red">Sorry, No Products Avaliable with that Sku Number.</ +font><br> </center> HTML } } print scalar localtime, $q->end_html

In reply to help with search script by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.