#!/usr/bin/perl -w

#### PS2P-1

#    VERSION: 1 (23 September 2003)
#    PURPOSE: Illustrate split and join 
#             (otherwise program doesn't do anything)

############## LIBRARIES AND PRAGMAS ################
  use strict;

#################### VARIABLES ######################

  my $LF = "\n";              # Linefeed
  my $sequence;
  my @triplets;
  my @letters;

################### MAIN PROGRAM ####################

  $sequence = "ATGGACGAGAGTTCTGATGCTAGCTTAAATAAATAA";
  @letters = split //, $sequence;

  while ($sequence =~ /(...)/g) {
     push @triplets, $1;
  }

  print "First triplet: ", $triplets[0], $LF;
  print "Last triplet: ", $triplets[-1], $LF, $LF;
  print "@triplets", $LF;
  print join ("|", @letters), $LF;
  print
