in reply to Printing two variables in the same line
First, use strict; and use warnings.
Next, there's no need to use @grades to initialize %grades. Just my %grades = qw( ... ) will work fine.
As for why it's not printing you've committed the classic mistake of using the assignment operator when you meant to test for equality. perldoc perlop and look for eq.
Update: And you also don't need to explicitly use the concatenation operator. Just "$_ has a $student\n".
Update: And really you don't need $student at all. Just exists $grades{ $_ } and print "$_ has a $grades{ $_ }\n" without it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing two variables in the same line
by radiantmatrix (Parson) on Oct 07, 2004 at 20:50 UTC | |
by JustLikeThat (Initiate) on Oct 07, 2004 at 22:00 UTC | |
|
Re^2: Printing two variables in the same line
by JustLikeThat (Initiate) on Oct 07, 2004 at 22:04 UTC |