Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^3: Iterating over verbatim hash reference

by Herkum (Parson)
on Jan 21, 2010 at 19:27 UTC ( #818801=note: print w/replies, xml ) Need Help??

in reply to Re^2: Iterating over verbatim hash reference
in thread Iterating over verbatim hash reference

Variables can help you clarify what you code does. Something an obscure data structure does not. For example,
my $DEBUG = 1; #... later in your code if ($DEBUG) { warn "Something happened\n" }

I bet your thinking that this is pretty obvious but I still want to reduce the number of variables.

If you think you have too many variables in a section of code, chances are you have not abstracted out it out enough. Move more of your code into other subroutines to enhance clarity.

my $dimensions = _get_dimensions_for(5,8); while (my ($r,$s) = each %{ $dimensions } ) { print($r); } sub _get_dimensions_for { my $x = shift; my $y = shift; return { x=> $x, y=> $y } }

Note: Thanks to ikegami for pointing out my error.

Replies are listed 'Best First'.
Re^4: Iterating over verbatim hash reference
by ikegami (Pope) on Jan 21, 2010 at 19:35 UTC
    Doesn't your snippet still suffer from the problem?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://818801]
[Corion]: choroba: A Bembel is a traditional pottery ware, which is only(!) used for serving Cider (well, Apfelwein)
[shmem]: choroba: it's hessisch
[Corion]: Not every Krug is a Bembel!
[karlgoethebier]: there is just the mug: 🍺
[Corion]: A Bembel must look like this
[karlgoethebier]: https://de. wiki/Bembel#/ media/File: Bembel_Zum_blauen_ Bock_1978.jpg
[choroba]: as my friend says, Ich stehe Deutsche ver nicht aber klein ;-)
[Corion]: Krug is generic pottery ware for pouring beverages, but a Bembel is painted with that blue paint and contains only (!) Apfelwein
[shmem]: Corion: alas, air too.
[Corion]: shmem: Yes, very sad!

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2017-05-24 08:51 GMT
Find Nodes?
    Voting Booth?