Update: I guess I goofed on the problem. Ooops. Sorry. Since, you don't have an each() loop in the Perl source code, I guess there must be something that is not in your Perl source code causing the error, which would I guess mean something in XS code? I am unable to imagine how this can happen otherwise.

I took the pragmatic approach and re-coded the loop to use a foreach() loop over (keys %$happy_camper) instead of trying to get the combined key,val each() iterator to work. I haven't had trouble adding keys with a foreach loop like below. Tested on Perl 5.20 MSWin32.

#!/usr/bin/env perl use strict; use warnings; use Data::Dump qw(pp); EXAMPLE: { my $happy_camper = { Rambler => 'The Yellow Rose of Texas', Wagon => 'There may be flies on them there guys but there ar +e no flies on us', Caskit => 'The Rain in Spain goes mainly down the drain', Skate => 'The Quick Brown Fox Jumped Over The Lazy Dogs Back +', Lemon => 'Love the smell of napalm in the morning' }; my $newkeys = 'KEYME000'; foreach ( 1 .. 900000 ) { foreach my $_key (keys %$happy_camper) { if ( int(rand 300000) == 1 ) { $happy_camper->{ ++$newkeys } = 'Shame on you!'; } } } pp $happy_camper; } exit 0;

In reply to Re: To each() their own by Marshall
in thread To each() their own by Ancient.Wizard

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.