Hi I have the following script
#!/usr/bin/perl -w
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
use strict;
use File::Basename;

our $list;
sub run_cmd {return print
span({-class=>'place_cmd'},submit(-name=>'action', -value=>shift)),p};
my %opts=(entry=>\&entry,
print1=>\&print1,
print2=>\&print2
);

my $cmd=param('action');
if ($opts{$cmd}){
$opts{$cmd}->();
}

run_cmd('entry');
&entry;
sub none {print header};
#}
sub entry {
print header();
print start_html('Man Pages');
print start_multipart_form;
print "man Page ",textfield('man');
run_cmd('print1');

print end_form;
print end_html;
}


sub print1 {

my %list;
print header();
print start_html('Man Pages');
my $page=param('man');
my @array=`find /usr/share/man -name $page*`;
my @list;
foreach my $man (@array){
push (@list,$man);

}

foreach my $list (@list){

my $name=fileparse($list);
my @man=split /\./, $name;
my $end = (scalar @man) -3;
my [EMAIL PROTECTED];
my $section=$man[-2];
my $title="$name1 Section  $section";
$list{$list}=$title;
}
my @list1;
foreach my $keys (sort keys %list){
push (@list1,$list{$keys});
}
print start_multipart_form;
print "select man page", popup_menu('sel',[EMAIL PROTECTED]);
run_cmd('print2');
print end_form;

$list=\%list;
foreach my $keys (keys %{$list}){
print $keys,br
}
print end_html;
return $list;
}

The problem is that the our $list hash ref reference is never getting updated

I would have thought that it should get updated in sub print1

any help appreciated

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to