Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 14th, 2000, 06:29 AM
sp00n sp00n is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: UK
Posts: 3 sp00n User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
  #2  
Old September 14th, 2000, 01:03 PM
JSchoof JSchoof is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Posts: 82 JSchoof User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 23 m 46 sec
Reputation Power: 9

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.

Reply With Quote
  #3  
Old September 18th, 2000, 06:23 AM
sp00n sp00n is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: UK
Posts: 3 sp00n User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
That worked with a bit of modifying, cheers.

Reply With Quote
  #4  
Old September 18th, 2000, 06:37 AM
sp00n sp00n is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: UK
Posts: 3 sp00n User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hmmm...Actually that is just listing the directory and not the contents of the directory :

Reply With Quote
  #5  
Old September 18th, 2000, 08:02 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Start here -> http://www.devshed.com/Talk/Forums/Forum6/HTML/000335.html Then alter the "print" line with "print "<option value...". Or you may include the $target_dir within that line.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Listing Files in Drop Box


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway