CGI/Perl Guide
|
Learning Center
|
Forums
|
Advertise
|
Login
Site Search:
in
Perl Guide
PerlGuru Forums
Learning Ctr
MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN
Home
:
Fun With Perl
:
Perl Quizzes - Learn Perl the Fun Way
:
undef(); and delete();
Print Thread
sleuth
Enthusiast
Dec 12, 2000, 1:45 PM
Post #1 of 3 (45299 views)
undef(); and delete();
Can't Post
$hash{'key'} = "value";
What is the difference between undef($hash{'key'}); and delete($hash{'key']); ?
Sleuth
perlplexer
Deleted
Dec 13, 2000, 6:13 AM
Post #2 of 3 (45287 views)
Re: undef(); and delete();
[
In reply to
]
Can't Post
1) delete($hash{'key'}); - deletes both the key and the value from %hash returning the deleted value.
exists($hash{'key'}) returns false
2) undef($hash{'key'}); - simply undefs the value that is associated with 'key'
exists($hash{'key'}) returns true
sleuth
Enthusiast
Dec 13, 2000, 12:06 PM
Post #3 of 3 (45278 views)
Re: undef(); and delete();
[
In reply to
]
Can't Post
Perfect Score!!!! You hit it right in the mark, that's exactly what I was getting at.
If you undef the hash key, exists($hash{'key'}); returns true.
Great job perlplexer,
Sleuth
Announcements
PerlGuru Announcements
Perl Programming Help
Frequently Asked Questions
Beginner
Intermediate
Advanced
Regular Expressions
mod_perl
DBI
Win32 Programming Help
Fun With Perl
Perl Quizzes - Learn Perl the Fun Way
Perl Golf
Perl Poetry
Need a Custom or Prewritten Perl Program?
I need a program that...
I Need a Programmer for Freelance Work
Throw Down The Gauntlet
General Discussions
General Questions
Feedback
Tutorial/Article Suggestions for The Learning Cent
Internet Security
Other Programming Languages
Javascript
PHP
Search
this forum
this category
all forums
for
All words
Any words
Whole Phrase
(
options
)
Powered by
Gossamer Forum v.1.2.0
Web Applications
&
Managed Hosting
Powered by Gossamer Threads
Visit our
Mailing List Archives