Help with using sub to update hash
- From: "Mike Martin" <redtux1 googlemail com>
- To: gtk-perl-list gnome org
- Subject: Help with using sub to update hash
- Date: Thu, 8 Mar 2007 02:58:09 +0000
I have the following code
#caller;
my %titles;
my %dvd_titles;
$dvd_act_btn->signal_connect('clicked'=>sub{$count++ &&
&dvd_setup($vbox2,$count,$sel_opts_vbox,\%titles,\%dvd_titles)});
#sub called
sub dvd_setup {
my ($vbox2,$count,$sel_opts_vbox,$titles,$dvd_titles)= _;
my $subname='dvd_setup';
#my %dvd_titles;
my %dvd_titles=%{$dvd_titles};
my %titles=%{$titles};
foreach my $keys (keys %dvd_titles){
print $keys,"=",$dvd_titles{$keys},"\n";
}
print scalar %dvd_titles;
foreach my $titles (sort keys %files){
if (${$files{$titles}}[0] eq $subname){
my $key=${$files{$titles}}[5]->get_active_text;
my $file=${$files{$titles}}[2];
unless (exists($dvd_titles{$key})){
$dvd_titles{$key}
};
push (@{$dvd_titles{$key}},${$files{$titles}}[2]);
}
}
foreach my $keys (keys %dvd_titles){
print $keys,"=",$dvd_titles{$keys},"\n";
}
}
However the hashes defined never get updated by the sub-routine "dvd_setup"
The hash is added to wuthin the sub (see later print lines), but
original hash is not getting updated.
Any help appreciated.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]