Science, Tech, Math › Computer Science Perl Array join() Function How to Use "join()" Functions in Perl for Beginning Programmers Share Flipboard Email Print Brand X Pictures/Getty Images Computer Science Perl PHP Programming Python Java Programming Javascript Programming Delphi Programming C & C++ Programming Ruby Programming Visual Basic View More By Kirk Brown Kirk Brown Computer Science Expert B.A., Abilene Christian University Kirk Brown is a systems software engineer with expertise in Perl, PHP, Ruby, and Python. Learn about our Editorial Process Updated on January 11, 2019 The Perl programming language join() function is used to connect all the elements of a specific list or array into a single string using a specified joining expression. The list is concatenated into one string with the specified joining element contained between each item. The syntax for the join() function is: join EXPR, LIST. Join() Function at Work In the following example code, EXPR uses three different values. In one, it is a hyphen. In one, it is nothing, and in one, it is a comma and a space. #!/usr/bin/perl$string = join( "-", "red", "green", "blue" );print"Joined String is $string\n";$string = join( "", "red", "green", "blue" ); print"Joined String is $string\n";$string = join( ", ", "red", "green", "blue" );print"Joined String is $string\n"; When the code is executed, it returns the following: Joined String is red-green-blueJoined String is redgreenblueJoined String is red, green, blue The EXPR is only placed between pairs of elements in LIST. It is not placed before the first element or after the last element in the string. About Perl Perl, which is an interpreted programming language, not a compiled language, was a mature programming language long before the web, but it became popular with website developers because most of the content on the web happens with text, and Perl is designed for text processing. Also, Perl is friendly and offers more than one way to do most things with the language. Cite this Article Format mla apa chicago Your Citation Brown, Kirk. "Perl Array join() Function." ThoughtCo, Aug. 26, 2020, thoughtco.com/perl-array-join-function-quick-tutorial-2641160. Brown, Kirk. (2020, August 26). Perl Array join() Function. Retrieved from https://www.thoughtco.com/perl-array-join-function-quick-tutorial-2641160 Brown, Kirk. "Perl Array join() Function." ThoughtCo. https://www.thoughtco.com/perl-array-join-function-quick-tutorial-2641160 (accessed June 10, 2023). copy citation