Perl Programming/Keywords/join

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: ioctl Keywords Next: keys

The join keyword[edit | edit source]

join joins the elements of LIST with the separators from EXPRESSION. The new string is returned.

Syntax[edit | edit source]

  join EXPRESSION, LIST

Examples[edit | edit source]

The print
  $login = "anton";
  $passwd = "j4\/D\\S";
  $uid = 1721169842;
  $gid = 8421691721;
  $gcos = "nothing";
  $home = "\\";
  $shell = "ksh";

  $rec = join(':', $login, $passwd, $uid, $gid, $gcos, $home, $shell);

  print $rec
returns the colon-separated string elements of the list:
anton:j4/D\S:1721169842:8421691721:nothing:\:ksh

See also[edit | edit source]

Previous: ioctl Keywords Next: keys