Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: Simplifying for loop and applying multiple push function

by VSarkiss (Monsignor)
on Dec 14, 2005 at 21:22 UTC ( #516768=note: print w/replies, xml ) Need Help??

in reply to Re: Simplifying for loop and applying multiple push function
in thread Simplifying for loop and applying multiple push function

To my way of thinking, it's simpler to write:

@one = values %hash; @two = keys %hash;
Even though the net result is the same.

Just wanted to show another WTDI.

Whoops, Roy Johnson is right, this is equivalent only in some circumstances.

Replies are listed 'Best First'.
Re^3: Simplifying for loop and applying multiple push function
by Roy Johnson (Monsignor) on Dec 14, 2005 at 21:23 UTC
    That's only the same if @one and @two started out empty.

    Caution: Contents may have been coded under pressure.
      Why does it matter whether @one or @two are empty beforehand? Won't the status of the hash and the arrays be identical regardless?

        How about if @one and @two arn't empty. The other answers don't empty them, this one clears out any previous values, which may or may not be desired.

        Eric Hodges $_='y==QAe=e?y==QG@>@?iy==QVq?f?=a@iG?=QQ=Q?9'; s/(.)/ord($1)-50/eigs;tr/6123457/- \/|\\\_\n/;print;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://516768]
[james28909]: another thing, i used to be atheist. life experiences, personal evidence. and my own perception is the reason why i believe the things i do.
[erix]: and now you are agnostic?
[james28909]: arunbear, your picking bits of history to fit your own narrative. right now, humans are smarter than in any of those times.
[james28909]: in order for there to be a mutation, there has to be a universe with laws setup that even allow a mutation.
[james28909]: everything past the first two things you piked from my posts are irrelevant to me and my beliefs. they are side effects.
[james28909]: two or three. if it has to do with how humans are handling said situations, then that is after they were able to evolve into those problems. agnostic means only believe with evidence. i took that from a tyson video
[james28909]: and it seems that racism suggest that there is indeed a better race, but that is for evolution to decide

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (12)
As of 2017-12-15 14:55 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (433 votes). Check out past polls.