in reply to Combining a hash into another

What's wrong with your solution? Another:

%styles = ( %styles, %SVGcal::styles );

And another:

@styles{ keys %SVGcal::styles } = values %SVGcal::styles;

You could also use each if memory is an issue:

while ( my ($k,$v) = each %SVGcal::styles ) { $styles{$k} = $v; }

Update: Added two other methods.

Replies are listed 'Best First'.
Re^2: Combining a hash into another
by John M. Dlugosz (Monsignor) on May 27, 2008 at 08:15 UTC
    Re: What's wrong with your solution?

    Mentioning the hash twice, and coding an explicit loop.

    The first one you mention seems to be inherently inefficient, unraveling both into lists and rebuilding. I was wondering if there was already a neat idiom that updated in place.

    I never remember how to "slice" since I do it so seldom; doing it the boooring way was just expedient to getting the code working. So thanks for posting your examples. --John