Erick J. Bourgeois wrote:
> [...]
> When "Button" is pressed it always falls through the if
> statement. Even in the case of no selection it falls through
> because @index[0], in this case, is undef. I know undef is
> the same as 0, but how could I get around this?

UNDEF IS NOT THE SAME AS 0! this is, speaking in perl terms,
an heresy and you shall be punished with eternal fire ;-)
undef is *evaluated* as 0 in numerical context and as "" in
string context, but is not 'the same'.
perl has a defined() function to check if something is
'not undef', including 0 and "". your if statement should
look like this:

    if( defined( $index[0] ) ) {


cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;



Reply via email to