I am using the sort method to sort names I retrieve from a database. Initially it works but if I try to access this same method a second time without closing out of my program, I get the following error
Use of uninitialized value in string comparison (cmp) at bppcsvver.pl +line 539. Tk::Error: Can't set -options to `ARRAY(0x1d1d0dc)' for Tk::Optionmenu +=HASH(0x3a c6244): No -label at C:/Perl/site/lib/Tk/Widget.pm line 256 at C:/Perl/site/lib/Tk/Derived.pm line 294 at C:/Perl/site/lib/Tk/Derived.pm line 306 Tk callback for .toplevel7 Tk callback for .toplevel7.frame Tk::Derived::configure at C:/Perl/site/lib/Tk/Derived.pm line 306 Tk::Widget::new at C:/Perl/site/lib/Tk/Widget.pm line 205 Tk::Widget::__ANON__ at C:/Perl/site/lib/Tk/Widget.pm line 256 BPP::Accounts::EditViewAccountsScreen at bppcsvver.pl line 550 BPP::BPPDEFAULTS::__ANON__ at BPP/BPPDEFAULTS.pm line 25
Here is my code:
my $a_user= $activeuserName; my %AccountHash; my @activeUserAccts=(); my $activeUserCount=0; @activeUserAccts = sort{$a->{acct_name} cmp $b->{acct_name}} BPP +::ACCOUNT->getActiveUser($activeuser); $activeUserCount = @activeUserAccts; my $active_user_acct = $acct_frame->Optionmenu(-options=>[map {[$_ +->{acct_name}=>$_->{acct_id}]} @activeUserAccts], -command=>sub {},-v +ariable=>\$activeUserAccts[0], -width=>25 )->grid(-row=>3, -column=>1 +,-sticky=>'nw'); $active_user_acct->addOptions(" ");
I dont' see what's uninitialized in my sort statement. Please help!

In reply to Uninitialized Value in Sort by mikasue

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.