Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > use list to assign hash...

Reply
Thread Tools

use list to assign hash...

 
 
Sean
Guest
Posts: n/a
 
      01-23-2006
After the following code, memory of hash is like
{
"fact"=>undef,
"story"=>undef,
}
Is it true?
----------------------------
#!/usr/bin/perl;
use strict;
my %hash;
my @my_list = ("fact", "story");
@hash{@my_list} =();
-------------------------------
 
Reply With Quote
 
 
 
 
Xicheng
Guest
Posts: n/a
 
      01-23-2006
Sean wrote:
> After the following code, memory of hash is like
> {
> "fact"=>undef,
> "story"=>undef,
> }
> Is it true?
> ----------------------------
> #!/usr/bin/perl;
> use strict;
> my %hash;
> my @my_list = ("fact", "story");
> @hash{@my_list} =();
> -------------------------------

you can help yourself by using "Data:umper", checkout
perldoc Data:umper

Xicheng

 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      01-23-2006
Sean <(E-Mail Removed)> wrote:
> After the following code, memory of hash is like
> {
> "fact"=>undef,
> "story"=>undef,
> }
> Is it true?



Yes.


> ----------------------------
> #!/usr/bin/perl;
> use strict;
> my %hash;
> my @my_list = ("fact", "story");
> @hash{@my_list} =();
> -------------------------------



--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign values from list to list of instances Gnarlodious Python 5 11-02-2011 04:52 AM
problem how to assign value to object list control chintinfong@gmail.com ASP .Net Mobile 0 06-12-2007 04:19 AM
Language specification: Why can't I assign list of string to listof object? Claudio Nieder Java 4 04-16-2007 09:30 PM
Why can't you assign to a list in a loop without enumerate? Danny Colligan Python 13 11-01-2006 08:08 PM
easiest way to split a list into evenly divisble smaller lists, and assign them to variables? flamesrock Python 3 06-07-2005 02:17 AM



Advertisments