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.
In reply to Re: New to Programming and I have chose PERL
by Tanktalus
in thread New to Programming and I have chose PERL
by snowsurfer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |