in reply to Help with strict

I think davido's reply is on the right track. To put that in other terms, consider the problem as follows: So the question is, what calls "do_command()", and how will you figure out why it's providing an incomplete set of data.

As for the other things within do_command and do_help that seem to be using $nick without any trouble, you should be aware that it's possible, grammatical, and no problem under "use strict", for a hash key to be an undefined value (although if you "use warnings" or include the "-w" flag, you will get run-time warnings about assigning to or referencing a hash element using an "undef" value as the hash key -- e.g. try the following test script, with and without the "-w" flag (or with and without "use warnings;"):

use strict; my %hash; my $key = undef; $hash{$key} = 3; print "A hash element with value $hash{$key} is stored with key=$key\n +";
Obviously, if you repeatedly use an undef or empty hash key to store different values into a hash, subsequent values will replace previous ones.

Replies are listed 'Best First'.
Re: Re: Help with strict
by Nkuvu (Priest) on Oct 29, 2003 at 01:57 UTC

    If the $nick isn't being initialized, you could just get around this by doing a conditional assignment. my $who = $_[0] || 'narf';

    This would result in a non-initialized value to return false. This might not be the ideal solution, however...