#!/usr/bin/perl-w $a="BATCATEATFATRAT"; $b=print_sequence($a,3); print"\n Scalar b=$b\n"; $output="Fmd .txt"; unless (open(RESULT,">$output")){ print"Cannot open file\"$output\".\n\n"; exit; } print RESULT"\n Formatted Data: $b\n\n"; close(RESULT); exit; sub print_sequence { my($sequence, $length) = @_; for (my $pos = 0; $pos < length($sequence); $pos += $length ) { print substr($sequence, $pos, $length), "\n"; } } #### Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\X>cd desktop C:\Users\X\Desktop>fm.pl BAT CAT EAT FAT RAT Scalar b= C:\Users\X\Desktop>

But the text file Fmd.txt does not show the words:

Formatted Data: