alokranjan has asked for the wisdom of the Perl Monks concerning the following question:
I have a folder "items" under which I have files like: fruit and animal containing the names of fruits and animals respectively. Now I want to use optgroup select option.
Can anyone please suggest me what went wrong. Many thanks in advance !!#!/usr/bin/perl print "Content-Type: text/html\n\n"; my @filename = split("\n", `ls items`); print <<HTML <html> <body> <select> HTML foreach(@filename){ print <<HTML <optgroup label="$_"> HTML open my $info, "items/$_" or die "Could not open $_: $!"; while( my $line = <$info>) { print <<HTML <option value="$line">$line</option> HTML } } print <<HTML </optgroup> </select> </body> </html> HTML
Regards, Alok
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: optgroup with Perl CGI
by Anonymous Monk on Oct 10, 2015 at 12:04 UTC | |
by alokranjan (Acolyte) on Oct 10, 2015 at 12:59 UTC |