Hi, Experts,
Here is a small piece of my perl code:
The code above is named as 'tt.pl'. And here is the output:
Why does 'eval()' not return a string of html code, somewhat like this:
I guess there must be something wrong in the line highlighted with blue color. But I don't know what it is.
Thank you for your help.
Here is a small piece of my perl code:
Code:
use strict;
use CGI::Pretty qw( :html3 );
my $q = new CGI::Pretty;
my @arr = ('a', 'b', 'c', 'd');
my (@cArr, %cLable);
my $select = "Pick One";
push @cArr, "'$select'";
$cLable{$select} = "0";
my $i = 1;
foreach (@arr) {
push @cArr, "'$_'";
$cLable{$_} = $i;
$i++;
}
[COLOR=blue]my $dropdown = qq/$q->popup_menu({-name=>'cname',-values=>\@cArr,-default=>"$select",-labels=>\%cLable});/;[/color]
[COLOR=red]my $dropdownInHTML = eval($dropdown);
print "The output of 'eval()': #$dropdownInHTML#\n";
[/color]
The code above is named as 'tt.pl'. And here is the output:
Code:
% ./tt.pl
The output of 'eval()': ##
Why does 'eval()' not return a string of html code, somewhat like this:
Code:
<select ......>
...
...
</select>
I guess there must be something wrong in the line highlighted with blue color. But I don't know what it is.
Thank you for your help.