From: Rob Dixon <[EMAIL PROTECTED]> > Rob Coops wrote: > > > > *Randal wrote:* > > *Perl doesn't have NULL. That'd be like saying "how do I make this pig > > fly?". > > It's a nonsense question. > > * > > I think this is a little to easy, perl does have a value that indicates that > > a variable does not have any set value it is called: undef > > In many other langueages like Java, Visual basic, C++, SQL, I thought even > > in Pascal a value of NULL signifies that the variable does not have a set > > value, it is not defined. Exactly what a value of 'undef' signifies in perl. > > > > Pigs do not fly that much is true even if you manage to throw them real high > > they will not fly but just crash right back to earth, but perl does have a > > way to indicate that a variable has no value set. > > > > I thik the thing that Randal was saying is that 'NULL' does not exist as a > > value in perl but he left out the part that others have pointed out before > > 'undef' has the same significance in perl as 'NULL' in other languages. > > The 'null' value in both C and Java is a null reference, and can't be used in > general to mean that a variable doesn't hold a value. As far as I know Visual > Basic's use of null is the same as SQL's, and applies only to database > operations.
VB has several different "null"s. A Variant variable can be: Empty If IsEmpty(var) Then Null - (if it comes from the database) If IsNull(var) Then Nothing - if it was an object, but now doesn't point to any If var Is Nothing Then ' consistency? Why?!? and of course then there is the empty string and zero. And the rules for computing and converting those are ... something that I never fully grasped ... except that I do know that no matter what you do you end up with code that will be way too long and still blow up in some cases. Cause some of those you can convert to string with CStr(), some of them you can't. Some of them you can treat as a string, some of them you can't. Same, but blowing up more often with numbers. And (getting even more OT) the idiot that designed VB decided that it's gonna be good fun to force everyone to copy&paste because the braindead interpreter/compiler evaluates all conditions COMPLETELY. So you can't do something like If rstRecordset.EOF or rstRecordset.Fields("Blah").Value = 1 Then it would blow up if the recordset was actually behind the last item. Even though that's what you wanted to test with that rstRecordset.EOF. You did, the result of the bloody condition was clear, but the unclefu...r evaluates the rstRecordset.Fields("Blah").Value nevertheless and blows up. Agrrrrrrrrr. Sorry for venting, I just had to tweak some old code in VBScript. Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/