Divide it into a specific number of fields.
#!usr/bin/perl use warnings; use strict; my $string = "this is a test."; my @words = split(/ /, $string, 3); print "\n"; print "$_\n" foreach ( @words );