Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL join Function
Syntax
Definition and Usage
Combines the elements of LIST into a single string using the value of EXPR to separate each element. It is effectively the opposite of split. Note that EXPR is only interpolated between pairs of elements in LIST; it will not be placed either before the first or after the last element in the string. To join together strings without a separator, supply an empty string rather than undef.
Return Value
Example
Try out following example:
#!/usr/bin/perl
$string = join( "-", "one", "two", "three" );
print"Joined String is $string\n";
$string = join( "", "one", "two", "three" );
print"Joined String is $string\n";
It produces following result
Joined String is one-two-three
Joined String is onetwothree
|
|

|
|
|