Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Re: Re: Non-destructive array processing

by demerphq (Chancellor)
on Jan 21, 2003 at 13:17 UTC ( #228669=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Non-destructive array processing
in thread Non-destructive array processing

The first is a reference to an array that has every element aliased to every element of @array.

Very very true. (I was going to say if it wasnt already said...) This has some devious implications. Consider the consequences of this:

$\="\n"; my ($x,$y,$z)=(1,2,3); my $r=sub{ \@_ }->($x,$y,$z,$z,$y,$x); print $r->[0]; # 1 $r->[-1]=10; print $r->[0]; # 10
So personally I wouldnt use this approach at all (for this anyway). Theres waaaay too much chance that somebody would come along and morph the code without understanding the deeper implications and then run around screaming about bizarre bugs.

--- demerphq
my friends call me, usually because I'm late....


Comment on Re: Re: Re: Re: Non-destructive array processing
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2014-04-17 13:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (449 votes), past polls