You have numerous syntax errors and mistypings, but you are getting there so persist! I know it is a pain to begin with, but please do not comment out use warnings and use strict. Try to understand why warnings and error messages are produced - they are your friends.
Here is my version to be getting on with, but always remember TMTOWTDI:
#!/usr/local/bin/perl
#Family.pl
use strict;
use warnings;
my %family = ('Connie' =>'Mama',
'Brandy' =>'Sissy',
'Pete' =>'Dude',
'Tristan' =>'Stinky',
'Sophera' =>'Finky',
'Priscilla'=>'BearDawg');
print"Please type in your name: ";
my $name = <STDIN>;
chomp $name; # It's good to chomp
# Convert to lower case with uc first char
$name = ucfirst(lc $name);
# Check for the absence of $name as a key
if( !exists $family{$name}) {
print"Thank you $name for participating but you are not family.\n"
+;
}
else {
print"Hey $family{$name}, thank you for being family!\n";
}
update: corrected
chop to
chomp (thank-you
toolic)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.