Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Effecicncy of key-only hash

by FunkyMonk (Chancellor)
on Aug 24, 2008 at 22:30 UTC ( [id://706593]=note: print w/replies, xml ) Need Help??


in reply to Effecicncy of key-only hash

As others have suggested, I'd do it like this
my %hash = map { $_ => 1 } qw{ shave the modern way };

because, wherever possible, I want to keep declaration with initialisation.

It's probably a personal thing, but it really bugs me when I've got to separate them, as in

my $str; $str = $_ x $freq{$_} for sort keys %freq;

which I had to write earlier today.

If you're really that concerned about speed, do it in C instead.
If you're really that concerned about memory, get more. It's really cheap nowadays.


Unless I state otherwise, all my code runs with strict and warnings

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2024-04-23 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found