#!/usr/bin/perl -w 

use strict;

# split into characters

my $word = "Abracadabra";
my @chars = split( //, $word);
print "The chars list: @chars\n";

# split records by a :
my $record = "Name:Rank:SerialNumber";
my @fields = split( /:/, $record);
print "Fields: @fields\n";

# split a line into words
my $string = "There are several words in this string";
my @words = split( / /, $string);
print "Word 1 = $words[0], word 5 = $words[4], last word = $words[$#words]\n";


# chomp.
$string = "A line of text that ends with a newline\n";
print ":$string:\n";
chomp($string);
print ":$string:\n";
