#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    UK
    Posts
    3
    Rep Power
    0
    I am fairly new to Perl and I have come across a problem that I cannot seem to find any help on.

    I am trying to list the contents of a directory on the server in a normal HTML Drop Down Box.

    Does anyone have any pointers or can help? it would be much appreciated =P
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    82
    Rep Power
    14

    Try This:

    #!/perl

    $dir = "/path/to/dir";
    @files = `$ls $dir`;
    chomp @files;

    print "<select>";
    for (@files) {
    print "<option value="$_">$_n";
    }
    print "</select>";


    That ought to do it.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    UK
    Posts
    3
    Rep Power
    0
    That worked with a bit of modifying, cheers.
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    UK
    Posts
    3
    Rep Power
    0
    Hmmm...Actually that is just listing the directory and not the contents of the directory :
  8. #5
  9. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    Start here -> http://www.devshed.com/Talk/Forums/F...ML/000335.html Then alter the "print" line with "print "<option value...". Or you may include the $target_dir within that line.

IMN logo majestic logo threadwatch logo seochat tools logo