in reply to New to Programming and I have chose PERL
Move your print statement to inside the braces for the if statement.
I'd also suggest looking at reformating a bit so you can more easily see what goes together:
(I'm not going to get into the One True Brace Style religious flamefest - so we'll just use the brace positioning you're already using.)#!/usr/local/bin/perl -w $input = ''; #temporary input $hrate = 0; #pay rate $yrate = 0; #yearly salary while () { print 'Do you wish to calculate yearly salary (y) or hourly rate?( +h)'; chomp ($input = <STDIN>); if ($input eq '') { last; } if ($input =~ /h/) { print "Enter your hourly rate:"; chomp ($hrate = <STDIN>); $yrate = ($hrate * 40) *52; print "Your yearly salary is $yrate\n"; } }
Hope that helps.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: New to Programming and I have chose PERL
by Lunchy (Sexton) on Jan 12, 2005 at 18:25 UTC |