i wrote this tiny code on gedit and ran it :-
#/usr/bin/perl
print "Enter the radius of circle: \n";
$radius = <>;
chomp $radius;
print "radius is: $radius\n";
$circumference = (2*3.141592654) * $radius;
print "Circumference of circle with radius : $radius = $circumference\n";
Runs fine using command line.Ran the same code on Komodo Edit: facing an issue i expect first line as output as :- Enter the radius of circle: whearas it waits on the screen i.e waiting for an input and after that runs everything in sequence — can someone tell me why it runs fine with command line but not Komodo?
output after changing #/usr/bin/perl to #!/usr/bin/perl:- also had to declare my $radius and my $circumference ———————————————————-
12 # same i had to enter 12
Enter the radius of circle:
radius is: 12
Circumference of circle with radius : 12 = 75.398223696
While ‘use strict’ and a correctly spelled shebang line are always good things,
neither is the actual cause. When you run an interactive program in a
non-command-line environment, you should usually turn off I/O buffering.
In Perl you should put this line at the top of your code: