Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: NULL Variables

by Limbic~Region (Chancellor)
on Feb 04, 2004 at 18:16 UTC ( [id://326544]=note: print w/replies, xml ) Need Help??


in reply to NULL Variables

dwalsh27,
Depending on what you mean - any one of the following might be what you want:
my $var; # undefined $var = undef; # explicitly set to undefined undef $var; # explicitly set to undefined $var = ''; # defined, but empty - will test false $var = 0; # defined with a value - which will test false $var = \0; # defined with a value of null
Cheers - L~R

Replies are listed 'Best First'.
Re: Re: NULL Variables
by dwalsh27 (Initiate) on Feb 04, 2004 at 19:34 UTC
    Thanks undef works. Isn't that the same as null??
      dwalsh27,
      No, undefined is not the same as being set to \0. That's why I said it depends on what you are trying to do with it. Unlike C, Perl strings are not null terminated. Maybe you are interested in knowing what is truth.

      Cheers - L~R

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://326544]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (2)
As of 2024-04-25 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found