first program in perl with ubuntu 10.04

Perl Programming on Ubuntu 10.04

first program in perl with ubuntu 10.04

Perl interpreter is actually installed from beginning on ubuntu 10.04(Lucid Lynx).So just start writing programs.If perl is not installed on ubuntu then go to synaptic package manager and search for perl;then install the latest version of perl.Perl is a script type programming language.Perl has very wide application in web development.Usually perl code use very less space and time in compare to other higher level programming languages like C.

Run.. First Perl program on Ubuntu 10.04

1. Open Gedit and write a small program given below to begin.

print “Welcome!\nEnter the two numbers… to add\n”;

print “First Number\t”;

$num1=<>;

chomp($num1);

print “Second Number\t”;

$num2=<>;

chomp($num2);

$sum=$num1+$num2;

print”sum of the two given numbers = $sum\n”;

2.Save it as sum.pl or any file name ending with .pl.
3.Open Ubuntu terminal CTRL+ALT+T or Applications->Accessories->Terminal.
4.Change the directory(Use cd command) to the destination of file(sum.pl).
5.Type the command ..in terminal
$ perl sum.pl
6.Then your program will be executed(if no error is present) and it will ask you to enter the two numbers and it will calculate the sum.
7.That’s All..If you find any problem ..then you may like to notify me through comment.

  • Elend

    I’m just curious. I’m using Ubuntu 10.04 and while I am able to run Perl programs on EMACS when I try testing a website using a server side script I used PERL to write (or PHP, Javascript or ASP, for that matter) it says that it cannot open it. How do I get the server to open a PERL file in online runtime?

  • http://twitter.com/Graphical Jeanine

    Perfect small program to check my first working perl script on Kubuntu. Thanks!

  • http://twitter.com/Graphical Jeanine

    Perfect small program to check my first working perl script on Kubuntu. Thanks!

    • Anonymous

      @twitter-19416748:disqus  Glad to know that it was somehow useful for you..
      Enjoy! :)

  • Naye_flo89

    Thanks ^^

  • Suresh meeraj

    Is there any way to improve Perl GUI progrmming