Hi,

$Window or $ModalWindow and you miss a } for if ?

For error: "Not a CODE reference at ...", i don't know exacly what append.
But it's probably because you need to add { } around (sort keys %PLZ)[$_].

for(0..((keys %PLZ) - 1)){
       if($Window->{(sort keys %PLZ)[$_]}->Checked == 1){
       print $PLZ{(sort keys %PLZ)[$_]}." is checked\n";
   }
}

I'm not sure understand your data structure.
I suppose keys in %PLZ is checkbox name and associate value is caption.
Something like that :

%PLZ = (
    "ChechBox1" => "Option 1",
    "ChechBox2" => "Option 2",
);

It's probably better to do something like that :

foreach (sort keys %PLZ) {
    if($Window->{$_}->Checked == 1) {
        print $PLZ{$_}." is checked\n";
    }
}

Laurent

----- Original Message ----- 
From: "YANDEX" <[EMAIL PROTECTED]>
To: <perl-win32-gui-users@lists.sourceforge.net>
Sent: Sunday, November 30, 2003 5:37 PM
Subject: [perl-win32-gui-users] not a CODE reference


> Hello perl-win32-gui-users,
> 
>   I have a small window with many checkboxes. I need to ask every
>   checkbox, so I:
>   for(0..((keys %PLZ) - 1)){
>       if($Window->(sort keys %PLZ)[$_]->Checked == 1){
>       print $PLZ{(sort keys %PLZ)[$_]}." is checked\n";
>   }
> 
>   this dont works, the error: "Not a CODE reference at ..."
> 
>   perldiag say to me: "(W overload) The second (fourth, sixth, ...)
>   argument of overload::constant needs to be a code reference.
>   Either an anonymous subroutine, or a reference to a subroutine."
>   
>   so I write workaround:
> 
>   for(0..((keys %PLZ) - 1)){
>        $Ch = (sort keys %PLZ)[$_];
>        if($ModalWindow->$Ch->Checked == 1){
>        print $PLZ{(sort keys %PLZ)[$_]}." is checked\n";
>   }
> 
>   can somebody tell me how can I do this without using intermediate
>   variable ($Ch) ??
> -- 
> Best regards,
> Pavel                         mailto:[EMAIL PROTECTED]
> 


Reply via email to