On Tuesday 06 May 2003 10:25 am, Dug Stokes wrote:
Hi!
Has anyone got five minutes to spare to be able to tell me how to get a list of files in the current directory with <option></option> around each file?
So far I've written;
print "<select name=file><option>";
print `ls\n`;
print "</option></select>";
But naturally, I need the <option> bit around each filename!
Please help!
Dug Stokes
You could do something like @files=`ls`; # no '\n' needed print "<select name=file>\n"; # note I've moved the <option> foreach(@files) { print "<option>$_</option>\n"; } print "</select>"; but for portability it's better to use perl functions - that way, for example the same perl code would work on a windows box. Try something like: print "<select name=file>\n"; # note I've moved the <option> print "<option>$_</option>\n" while (<*>); print "</select>"; Gary -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000