6 May
2003
6 May
'03
13:10
Dug Stokes
print "<select name=file><option>"; print `ls\n`; print "</option></select>"; But naturally, I need the <option> bit around each filename!
Quick and dirty, based on your code: print '<select name="file"><option>' . join("</option><option>",map({chomp; $_} `/bin/ls`)) . '</option></select>'; map(fn array) is an often-overlooked function to apply a function to every element of an array, here used to trim the trailing end of lines. join(glue,array) sticks an array together with the glue between them. The dots are string concatenation. -- MJR http://mjr.towers.org.uk/ IM: slef@jabber.at This is my home web site. This for Jabber Messaging. How's my writing? Let me know via any of my contact details.