copying a multidimensional array

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default copying a multidimensional array

    Hi: whatz the best way to copy an multidimensional
    array onto another. I have never used something like
    clone, just want to know whatz the easiest route.

    Thanks
    Ravi

    __________________________________
    Do you Yahoo!?
    Protect your identity with Yahoo! Mail AddressGuard
    [url]http://antispam.yahoo.com/whatsnewfree[/url]
    Ravi Malghan Guest

  2. Similar Questions and Discussions

    1. multidimensional array assignment
      dear all, I am a facing a problem in multidimensional array. The problem is that when i am trying to copy the value of arry named 'str' to...
    2. copying a multidimensional array to $_SESSION
      Probably a simple question but I can't find the answer anyway. Specifically, is it possible to copy a multidimensional array into the $_SESSION...
    3. Multidimensional array: see if 1st key is available
      Hi, I've got an multidimensional array $ret = $country_code; Now I want to see if $countryCode is even in that array, because if it's not, it...
    4. Split multidimensional array into 4 multidimensional arrays
      Hello everyone, I have a multidimensional array that I need to split into 4 multidimensional arrays. I've tried the examples from the...
    5. Sorting a Multidimensional Array
      I have an array like this: $events = array( array( '2003-07-01', 'Event Title 1', '1' //ID Number (not unique) ), array( '2003-07-02',
  3. #2

    Default Re: copying a multidimensional array

    On Thu, Nov 13, 2003 at 10:06:19AM -0800, Ravi Malghan wrote:
    > Hi: whatz the best way to copy an multidimensional
    > array onto another. I have never used something like
    > clone, just want to know whatz the easiest route.
    Storable::dclone() is probably the easiest:

    use Storable qw(dclone);

    my @x = ([0,1,2], [3,4,5]); # "multidimensional" array
    my @y = @x; # shallow copy
    my @z = @{ dclone(\@x) }; # deep copy

    require Data::Dumper;
    print Data::Dumper->Dump( [\(@x, @y, @z)], [qw(*x *y *z)] );

    --
    Steve
    Steve Grazzini Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139