sub save_selected { my @check_boxes = @{ shift; }; my $doc_nr = &Kephra::Document::_get_current_nr; for ( 0 .. $#check_boxes ) { if ( ref $check_boxes[$_] ne '' ) { if ( $check_boxes[$_]->GetValue ) { ... } } } ... }