Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: New perl student... feeling stupid
by FouRPlaY (Monk) on May 18, 2001 at 20:57 UTC | |
by Tanya (Initiate) on May 18, 2001 at 21:32 UTC | |
by arturo (Vicar) on May 18, 2001 at 22:26 UTC | |
|
(boo) Re: New perl student... feeling stupid
by boo_radley (Parson) on May 18, 2001 at 21:04 UTC | |
|
Re: New perl student... feeling stupid
by mirod (Canon) on May 18, 2001 at 22:29 UTC | |
by chipmunk (Parson) on May 18, 2001 at 23:30 UTC | |
by runrig (Abbot) on May 18, 2001 at 23:28 UTC | |
|
Re: New perl student... feeling stupid
by AidanLee (Chaplain) on May 18, 2001 at 21:00 UTC | |
|
Re: New perl student... feeling stupid
by diarmuid (Beadle) on May 18, 2001 at 22:13 UTC |