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

Perl/Basics/Helper Functions/Join

From NetSec
Revision as of 03:15, 16 July 2012 by AlizaLorenzo (Talk | contribs) (Created page with "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 scala...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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>