Oky My teacher has asked us to take a text file that he has created and count the number of paragraphs, sentances, and vowels, Then take the words that start with consonants and UC them. Then take words that start with vowels and lc them.
I have written what I thought would be correct however I keep getting these errors:
Name "main::para" used only once: possible typo at Dadis_Tanya_lab3.pl line 8.
Name "main::sen" used only once: possible typo at Dadis_Tanya_lab3.pl line 13.
Name "main::vow" used only once: possible typo at Dadis_Tanya_lab3.pl line 19.
and I don't know what it means by used only once.
Here is my code below. Please help a new perl student.
#!/usr/bin/perl -w %count = ("vow",0,"con",0,"word",0,"para",0,"sen",0); while ( <> ) { $b = <>; if ( length($b = $_) != 0 ) { $para++; } $a = $_; while ( $a =~ /[.?!]/) { $sen++; $a = $'; } $a = $_; while ( $a =~ /[aeiou]/i ) { $vow++; $a = $'; } } while ( <> ) { $a = $_; while ( $a =~ /\b([a-z],[^aieou])/i) { $str = $` . uc($1); $a = $'; } $a = $_; while ( $a =~ /\b([aeiou])/i) { $str = $` . lc($1); $a = $'; } } print $b; print $a; foreach $value (keys %count) { print "$value"; } $ *lab3.pl lab3.txt
In reply to New perl student... feeling stupid by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |