in reply to Re: perl prog to read a sentence and print the count of chars for each word
in thread perl prog to read a sentence and print the count of chars for each word

#!/usr/strawberry/perl/bin print ("Enter a sentence \n"); $count = 1; $str = <STDIN>; chop ($str); @array = split (' ', $str); while ($count <= @array){ $word = $array $count - 1; $lengthWord = length($word); print (" ", $lengthWord); $count++; }
  • Comment on Re^2: perl prog to read a sentence and print the count of chars for each word

Replies are listed 'Best First'.
Re^3: perl prog to read a sentence and print the count of chars for each word
by toolic (Bishop) on Feb 20, 2012 at 23:26 UTC
    • Please reformat your post using code tags: Writeup Formatting Tips
    • Please accompany your code with some text. Why did you post this code? Does it work the way you expect? Do you want a critique of the style?