How to add array to array in Perl?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wiinie
    New Member
    • Feb 2011
    • 47

    How to add array to array in Perl?

    Hi, I have a question about the array.

    I have an array
    @array = ('dic', 'tum, 'st');
    now to want to add

    @array[1] to @array[0] in order to get
    @array[1] = 'dictum';


    can anyone help me please..


    Thanks
  • miller
    Recognized Expert Top Contributor
    • Oct 2006
    • 1086

    #2
    Code:
    $array[1] = join '', @array[0,1];
    FYI, This isn't adding an array to an array. This is concatenating two elements of an array.

    - Miller

    Comment

    • Wiinie
      New Member
      • Feb 2011
      • 47

      #3
      thank you very much my master of Perl scriot
      Can I have anther question for u?
      do you know how can i count the matching word in the string
      such as I have dic~tum~st

      how can i count how much time that i match it..

      Comment

      • miller
        Recognized Expert Top Contributor
        • Oct 2006
        • 1086

        #4
        already asked and answered in your other thread:

        Comment

        • Wiinie
          New Member
          • Feb 2011
          • 47

          #5
          yes. I did not c before i asked u again .. anyway .. thank you a lot about your help //

          Cheer .. Master of Perl/~~~

          Thanks

          Comment

          Working...