Hi Saran, overall, pretty good code.
On Monday 25 October 2010 18:21:31 saran wrote: > i am new to perl. please help me with this piece of code below. > answer wat it prints is correct but the format has to adjusted...! > program to convert Celsius to Fahrenheit > *************************************************************************** > ******* #!/usr/bin/perl > use warnings; > use strict; > > print "Celsius to Fahrenheit Conversion\n"; > print "Enter the value of Celsius to be converted:"; > > my $c = <STDIN>; You need a chomp() call here: {{{ my $c = <>; chomp($c) }}} Note that I've omitted the STDIN - using ARGV instead of STDIN is almost always a better idea. > my $f = ($c*1.8) + 32; > print "$c"."C is equal to ", "$f","F","\n" Now this should work properly, but note that you should write it as: {{{ print "${c}C is equal to ${f}F\n"; }}} No need to split arguments so erratically, and you shouldn't use «"$c"» instead of «$c», unless you want to stringify a special object (which in this case you don't. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Understand what Open Source is - http://shlom.in/oss-fs <rindolf> She's a hot chick. But she smokes. <go|dfish> She can smoke as long as she's smokin'. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/