Results 1 to 6 of 6

Thread: How to Manipulate Array in Perl?

  1. #1
    Join Date
    Dec 2009
    Posts
    38

    How to Manipulate Array in Perl?

    Hi All,

    I have one question to ask you about the Perl language. I am getting more difficulties while understanding the Array in Perl. I am not getting how to Manipulate Array in Perl. I have referred different book for this concept without any luck. If anybody of you has the sound knowledge about the array manipulation in Perl then please share your knowledge with me. Your help would appreciable.

  2. #2
    Join Date
    May 2008
    Posts
    2,302

    Re: How to Manipulate Array in Perl?

    In 'Perl' the array manipulation is achieved in very different ways than other languages. See below it's syntax
    @CombinedArray = (@ArrayName1, @ArrayName2);
    The above syntax of Perl is used to combine two array. output of above code will display the combination of all elements of @ArrayName1 as well as @ArrayName2. You can use the below syntax to append the array elements.
    @MyArrayName = (@MyArrayName, $NewElement);

  3. #3
    Join Date
    Oct 2005
    Posts
    2,394

    Re: How to Manipulate Array in Perl?

    Hi friend,

    I suggest you to refer following example which will depicts how to Manipulate Array in Perl:
    #! C:\programfiles\perl\bin\perl
    print "content-type: text/html\n\n";
    @array01 = ("blue", "green");
    @array02 = ("red", "white");
    @combined = (@array01, @array02);
    $, = "\n";
    print @combined;
    print "<br>";
    @new = (@combined,yellow);
    $, = "\n";
    print @new;

  4. #4
    Join Date
    May 2008
    Posts
    2,393

    Re: How to Manipulate Array in Perl?

    Hi,

    Perl programming language is basically designed for to manipulate and read text data. It Perl it is very easy to manipulate the array data because the interpreter of Perl the array data which is based onto contextual data. In Perl the manipulation techniques of array is limited to the elements counting of Perl array or key-value pairs iteration.

  5. #5
    Join Date
    Feb 2008
    Posts
    1,856

    Re: How to Manipulate Array in Perl?

    In Perl is very simple to build an array of arrays sometime it is referred as list of lists. Suppose you want to declare the array named as @AOP, and which is of [3][2] size. Then you need to implement following code code for this array declaration.
    @AOP = (
    [ "asd", "iok" ],
    [ "vbn", "esw", "tgf" ],
    [ "uij", "qasw", "nmkl" ],
    );
    print $AOP[2][2];
    bart

  6. #6
    Join Date
    Jan 2008
    Posts
    1,521

    Re: How to Manipulate Array in Perl?

    Hello friend,

    To print the some part of the array in Perl, for this we need to use the subscripting concept of Perl. You can use the pointer arrow for de-referencing the array. suppose you have to print some part of the @AOO array in Perl language, then you need to use the below code:
    @part1 = ();
    $x1 = 4;
    for ($y1 = 7; $y1 < 13; $y1++)
    {
    push @part1, $AOO[$x1][$y1];
    }

Similar Threads

  1. How to manipulate an ISO images
    By Zeppelin in forum Operating Systems
    Replies: 4
    Last Post: 31-12-2010, 12:44 AM
  2. How to manipulate text in Authorware
    By Lawford in forum Windows Software
    Replies: 5
    Last Post: 16-03-2010, 02:21 AM
  3. How to Manipulate DOM of Applet's Web Page?
    By shivendra in forum Software Development
    Replies: 5
    Last Post: 18-02-2010, 12:53 AM
  4. How to manipulate JavaScript text?
    By Juaquine in forum Software Development
    Replies: 4
    Last Post: 11-02-2010, 04:46 PM
  5. Manipulate jQuery with PHP
    By Zecho in forum Software Development
    Replies: 5
    Last Post: 16-06-2009, 02:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •