Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: Re: Creating a copy of an array

by ichimunki (Priest)
on Dec 19, 2000 at 10:27 UTC ( [id://47353]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Creating a copy of an array
in thread Creating a copy of an array

Cool. I think using turning the sub into an expression is much better. So how does any module beat a one liner? :)
  • Comment on Re: Re: Re: Creating a copy of an array

Replies are listed 'Best First'.
Re: Re: Re: Re: Creating a copy of an array
by repson (Chaplain) on Dec 19, 2000 at 15:56 UTC
    A one liner generally cannot take Everything into account. Since code may one day be reused in something else, something like my first snippet will work for the current problem but will be broken for others.

    My second snippet (with Data::Dumper) will work for most common problems of the copy type since it expands absolutely everything before recreating the structure. However using eval makes it likely to be slow, possibly insecure and less reliable.

    I suggest you have a good look at this article which provides a furthur in depth discussion of deep copying (which is what we are talking about here).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-18 00:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found