Perl array element manipulation -


I was trying and trying with this one, but it just does not seem to be the click if I have a Array, then say 6 numbers:

  @ a = (1,2,3,4,5,6)   
  1. How do I get every other index (2, 4, 6) in this matter?

  2. How do I calculate the difference of every two elements, then the output will be here:

    1 1 1 (because 2-1 = 1 and 4-3 = 1 and so on ..) $ a or $ b , they are special (< Code> sorting using them ...) ... is usually better for giving your variable a descriptive name, letting it know as to what kind of variable it is (my $ index = 0; $ index

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -