what is the meaning that alias passed an array parameter in perl? -


What does this mean that passes an array parameter in the parachute parallel? Is the correct code below?

  #! / Usr / bin / perl @ myarray = (1, 2, 3, 4, 5); & Amp; My_sub (@myarray); Sub my_sub {my (@subarray) = @_; Print @sabarere; }    

The word alias describes that many names indicate In the same data, without the syntax restriction of references.

In Pearl, nicknames can be made arbitrarily eg. , But there are some such constructions that make aliases themselves.

  1. Foreground is a nickname for the original element in the current element list:

      my @ray = 1. 5; My $ elem (@array) {$ elem ++; # $ AMM $ array [$ i]} is a nickname for # # ARR is now 2. 6.    
  2. Subroutine Logic: Pearl Sabretin to Scalers Called with a flat list (i.e. a collection like hash or arrays flatten in this list). This list is accessible through the @_ array. All elements of this array are the nicknames for parameters.

      sub alias_increment {my $ elem (@_) {$ elem ++; }} My @array = 1 .. 5; Alias_increment (@array); # Array is now 2. 6.   

    Note that in this example, there is no alias for @_ @array , But has the nickname for $ _ [$ i] $ sir [$ i] .

    Using these nicknames can give you out-arguments, but it creates a single API for IMHO.

    You should also keep in mind that in Perl generally it is simulated semantic , that means $ foo = $ bar Typically $ bar to $ foo data copies . If copying in the list reference, all elements are copied, that means that

      my @ray = is a separate unit per copy, and if the original was a nickname, @_;   

    does the same thing

      my @ray; $ Array [0] = $ _ [0]; # ...   

    This breaks all aliasing .

    This is actually used as a pattern in Pearl ??? Call from price ???? And to limit the side effects of the sub-root.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -