Monday, November 21, 2011

PERL JOIN OPERATOR

PERL JOIN OPERATOR



 

REVISED: Sunday, March 3, 2013




You will learn how to use the Perl join operator.

I.  PERL JOIN OPERATOR INTRODUCTION

The syntax form of Perl join operator is as follows:

$string = join (EXPR, LIST);

The join operator has two parameters:

EXPR may be any string and it represents a separator for the element of the list or array.

LIST represents a list or array whose elements will be merged into a string.

The join operator will return a string that contains the elements of the array or list, connected through a string separator.

II.  PERL JOIN OPERATOR EXAMPLE

The following example demonstrates the use of the join operator:

#initialize an array
my @perlFunc = ("Mary","had","a","little","lamb.");
my $perlFunc = join " ", @perlFunc;
print "Perl Functions: $perlFunc\n";

Output: Mary had a little lamb.

We used the space separator " " to glue the elements of the @perlFunc array. You can omit the parentheses when you call the Perl join operator.

You have learned how to use the Perl join operator.

Elcric Otto Circle






-->




-->




-->












How to Link to My Home Page

It will appear on your website as:
"Link to ELCRIC OTTO CIRCLE's Home Page"






No comments:

Post a Comment