Questions about this topic? Sign up to ask in the talk tab.

Difference between revisions of "Perl/Basics/Variables and Data Types/Helper Functions/Join"

From NetSec
Jump to: navigation, search
 
Line 1: Line 1:
 +
<noinclude><font size="-2">'''[[Perl]] > [[Perl/Basics|Basics]] > [[Perl/Basics/Variables and Data Types|Variables and data types]] > Join'''</font></noinclude>
 +
 
Join will compile an array into a scalar.  Using the array example above, '''@messages''', the following code will generate the string "Hello world!\n, I like perl!\n" as a scalar:
 
Join will compile an array into a scalar.  Using the array example above, '''@messages''', the following code will generate the string "Hello world!\n, I like perl!\n" as a scalar:
  

Latest revision as of 03:39, 22 October 2012

Perl > Basics > Variables and data types > Join

Join will compile an array into a scalar. Using the array example above, @messages, the following code will generate the string "Hello world!\n, I like perl!\n" as a scalar:

<syntaxhighlight lang="perl">my @messages = ("Hello world!\n","I like perl!\n"); my $joined_message = join(", ",@messages); print $joined_message;</syntaxhighlight>