in reply to Problem with using XBase

It looks like just the kind of thing use strict would have caught: you're assigning a value to $lastname (lowercase) and then testing $LASTNAME (uppercase).

Also, if you're testing strings for equality, you should be using eq, not ==. In sum, your line should look like this:

$table->update_record_hash($_, TEST => "It works") if $lastname eq "Smith";

HTH

Replies are listed 'Best First'.
Re: Re: Problem with using XBase
by DingoBaby (Initiate) on Jan 25, 2002 at 03:28 UTC
    Thank you..It works splendidly now. What is the "use strict" you referred to? I am very grateful for your assistance. Sincerely, Todd

      You're welcome. The use strict I referred to brings in the strict Perl module (technically, it's a pragma) into your program, which restricts it from doing certain things. You can read about it here or here.

      In a (very simplified) nutshell, it does three things:

      1. It disallows using variables which haven't been declared in some fashion, such as with my, our, use vars, etc. This would've caught your upper/lower case problem since there was no declaration for $LASTNAME.
      2. It generates an error if you use a bareword (i.e., an identifier with no type symbol like $, @, and %).
      3. It prevents you from using symbolic references. That's a bit of an advanced topic; at this stage you should just avoid them unquestioningly. ;-)
      It's the collective wisdom of the Perl community that any script longer than a few lines should always begin with use strict. I heartily agree.