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

Re: Concerning hash operations (appending, concatenating)

by BUU (Prior)
on Mar 24, 2005 at 21:09 UTC ( #442196=note: print w/replies, xml ) Need Help??

in reply to Concerning hash operations (appending, concatenating)

Duh, just use array_merge from "Array-PAT", which I've reproduced below for your convience:
sub array_merge{ my(@array1, @array2) = @_; foreach my $element (@array2){ @array1 = (@array1, $element); }#foreach return @array1; }#array_merge

Replies are listed 'Best First'.
Re^2: Concerning hash operations (appending, concatenating)
by demerphq (Chancellor) on Mar 25, 2005 at 08:06 UTC

    Is this a joke BUU?

    Lets have a look at the code:

    my(@array1, @array2) = @_;

    So this line will magically split @_ into two parts, the first part will go into @array1 and contain the whole contents of @_, @array2 will be empty.

    foreach my $element (@array2){ @array1 = (@array1, $element); }#foreach

    Good thing this loop never executes as its a pretty inefficient way to add elements to an array. Perhaps the author has never heard of push.

    So this entire subroutine could be replaced by:

    sub array_merge{ @_ };

      Of course it's a joke.

      Good lord.
      Wow, that's actual code checked into CPAN.

      I guess it does what it says it does, anyways, just has some code that's never used.

      I guess I don't understand what it has to do with concatenating hashes??
      "But what of all those sweet words you spoke in private?"
      "Oh that's just what we call pillow talk, baby, that's all."
        Well, since hashes can be listified, you could use this to merge two lists that just happen to be hashes. And yes it's utterly pointless.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://442196]
[stevieb]: can anyone recommend a good IDE for C programming that has *proper* vim plugin support? I've tried Eclipse, Netbeans etc and just can't get anything to work properly on Linux. I'm open to paying, but not on some monthly/yearly plan (just a one-off cost)
[stevieb]: I'd go with CLion as it's very similar to what I use already (intelliJ for Perl, Pycharm for Python), but it's a recurring fee every year

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2017-01-18 19:09 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (163 votes). Check out past polls.