#!/usr/bin/perl-w ## To chop a sentence at intervals of 4-letter and to print results: use strict; my $sentence="BEAR CALF DEER FEAR GEAR HEAR"; ## To remove blank spaces: # Line 5 $sentence=~ s/\s//igs; print"\n Words are: \n"; do { my @four=$sentence=~ /[a-zA-Z]{4}/igs; # Line 9 foreach my $word(@four) {print"\n $word: "; my $length=length($word); print"\n Length of the word= $length\n\n"; my $output="Words .txt"; # Line 14 unless (open(RESULT,">$output")){ print"Cannot open file\"$output\".\n\n"; # Line 16 exit; } print RESULT"\n Words are: \n Word: $word; Length of the word= $length\n\n"; close(RESULT); # Line 21 } until ( my $word=~ /^.*$/); # Line 22 exit; } #### Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\xxxxxxx\Desktop>word.pl syntax error at C:\Users\xxxxxx\Desktop\word.pl line 22, near ");" Execution of C:\Users\xxxxxxxx\Desktop\word.pl aborted due to compilation errors.