in reply to Re: Missing something with regards to references
in thread Missing something with regards to references

What you're missing is that this is an example, this is not the actual application or the proper use of the function. It's been simplified in order to be able to directly address the issue I am having without the confusion of the full complexity of the program.

The whole point of a data structure is to be dynamic... and if it's dynamic then I wont know whether I'm assigning to $DATA{3}{h}{i}, or $DATA{3}{h}{i}{j}, or $DATA{3}{h}{i}{j}{k}. So I need a function that adapts to the number of dimensions of the hash dynamically.

  • Comment on Re^2: Missing something with regards to references

Replies are listed 'Best First'.
Re^3: Missing something with regards to references
by cLive ;-) (Prior) on Nov 01, 2004 at 22:49 UTC
    Right, but my point is, what are you trying to achieve by calling this:
    put_element($DATA{3}, 'h', 'i', 'j', 'k', 'value');

    rather than this:

    $DATA{3}{h}{i}{j}{k} = 'value'

    I don't see how the sub optimizes anything, or provides anything that a direct call does.

    Unless you're calling it like this:

    my @arr = qw(h i j k); put_element($DATA{3}, @arr, 'value');

    Is that how you're using it?

    cLive ;-)