135

Built-In Functions
Split

  • The split() function returns a list created by using a pattern as a delimiter to break a target string into sub-strings

      $myString = "This is a test";
      @myList = split( /\s+/, $myString );
      # $myList[0] is now "This"
      # $myList[1] is now "is"
      # $myList[2] is now "a"
      # $myList[3] is now "test"