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

Re: Re^3: setting hash keys by array

by blssu (Pilgrim)
on Sep 09, 2002 at 21:03 UTC ( #196444=note: print w/replies, xml ) Need Help??

in reply to Re^3: setting hash keys by array
in thread setting hash keys by array

Did your $ptr = 1 line really work on your machine? It didn't on mine.

At least your new code is correct... ;) BTW, if you use the -1 index on array, you don't need to shift @array in the loop -- that's the version I'd prefer in production code.

Anyways, it was just fun looking at alternatives. It's not often I see a clean use of type globs!

Replies are listed 'Best First'.
Re^5: setting hash keys by array
by Aristotle (Chancellor) on Sep 10, 2002 at 08:57 UTC
    Oops. I wrote the while version first and forgot to change the shift into a plain $_ when I copypasted. Fixed.

    Makeshifts last the longest.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2021-12-06 06:34 GMT
Find Nodes?
    Voting Booth?
    R or B?

    Results (31 votes). Check out past polls.