#!/usr/bin/perl # Ivan Novick # Feb, 2008 # split on whitespace use strict; use warnings; my $teststring = " Today is the day that I went to the shop for coffee "; # split on whitespace # leading and trailing whitespace is ignored my @words = split(' ', $teststring); foreach (@words) { print "Word is '$_'\n"; }