Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Syntax error in using do-until loop: How can I fix it?

by aitap (Deacon)
on Jul 16, 2012 at 10:22 UTC ( #981998=note: print w/ replies, xml ) Need Help??


in reply to Syntax error in using do-until loop: How can I fix it?

The opening vurly bracket ({) that matches the closing one (}) on line 22 is placed on line 11, so your code between these lines looks like this: { some; code; } (while my $word =~ /^.*$/)

I guess that you missed closing curly bracket (}) after line 13:

foreach my $word(@four) {print"\n $word: "; my $length=length($word); print"\n Length of the word= $length\n\n"; } # there
and the one on line 24 is not needed.

UPD: you can split words easier using split:

#!/usr/bin/perl -w use strict; use Data::Dumper; my $sentence="BEARCALFDEERFEARGEARHEAR"; print Dumper (split /(.{4})/,$sentence); __END__ $VAR1 = ''; $VAR2 = 'BEAR'; $VAR3 = ''; $VAR4 = 'CALF'; $VAR5 = ''; $VAR6 = 'DEER'; $VAR7 = ''; $VAR8 = 'FEAR'; $VAR9 = ''; $VAR10 = 'GEAR'; $VAR11 = ''; $VAR12 = 'HEAR';

Sorry if my advice was wrong.


Comment on Re: Syntax error in using do-until loop: How can I fix it?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://981998]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (13)
As of 2015-07-31 17:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls