Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^4: How to create a new array with the same name as an existing one in a loop? (Updated)

by LanX (Sage)
on Aug 15, 2021 at 18:43 UTC ( #11135864=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to create a new array with the same name as an existing one in a loop?
in thread How to create a new array with the same name as an existing one in a loop?

There are various modules offering a "clone" routine, even in core.

But the question is tricky because details are important if blessed objects ° are involved or speed matters.

In the end you need to know what you really want.

Update

°) To be more specific how do you clone an arbitrary object "correctly" if the class doesn't provide a clone method?

And what is "correctly" and "good enough" ? :)

Update

For instance an array @bus containing objects of persons sitting in a bus like say $Rolf and $MrSnrub.

After copying the bus, it'll depend on the application if you really want to clone the persons too.

I'd consider creating a clone of person highly unwanted. Especially identity theft of $Rolf. ;)

If I'm the passenger in two different busses, you'd want to update personal information like addresses only once...

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re^4: How to create a new array with the same name as an existing one in a loop? (Updated)

Replies are listed 'Best First'.
Re^5: How to create a new array with the same name as an existing one in a loop? (Updated)
by karlgoethebier (Abbot) on Aug 16, 2021 at 05:03 UTC

    «It doesn't and you can't I won't and it don't It hasn't, it isn't, it even ain't And it shouldn't, it couldn't!" He told me "no, no, no!" I told him "yes, yes, yes!" I said: "I do it all the time Ain't this boogie a mess"» (FZ)

    «The Crux of the Biscuit is the Apostrophe»

      What???

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135864]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2022-01-21 00:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (57 votes). Check out past polls.

    Notices?