Quantcast
Channel: Perl Programming
Browsing all 25 articles
Browse latest View live

Basic Program in Perl Script with print statement

$var='Raja Ram Mohan Roy';$x="Hi!,$var";print "$x \n";

View Article



Arithmetic Operators Example in Perl Script

$x=<STDIN>;$y=<STDIN>;$z=$x+$y;print "Sum Of Two Number(X,Y) is :- $z \n";$z=$x-$y;print "Minus Of Two Number(X,Y) is :- $z \n";$z=$x*$y;print "Multiplication Of Two Number(X,Y) is :- $z...

View Article

Check Whether you have entered +ve, -ve, or zero number

print "Enter a Number Value :";$num=<STDIN>;chop($num);if($num>0){  print "\n You Have Entered Positive Number \n";}elsif($num<0){ print "\n You Have Entered Negative Number...

View Article

Multiplication table in Perl

print "Enter a Multiple Value : \n";$num=<STDIN>;$i=1;chop($num);while($i<=10){  print "$num X $i = ",$num*$i,"\n";  $i++;}

View Article

Calculate gross pay of employee in Perl

print "Enter Basic Pay Of An Employee";$bp=<STDIN>;chop($bp);$da=0.4*$bp;$hra=0.2*$bp;$gp=$bp+$da+$hra;if(($gp*12)>175000){  $it=0.5*($gp);}else{  $it="Not Applicable";}print "\n Basic Pay is...

View Article


Perl script for calculating distance in metres, centimeteres, feet, inches

print "\n Enter The Distance in KiloMetres : \n";$km=<STDIN>;$m=$km*1000;$cm=$m*100;$inch=$cm/2.54;$ft=$inch/12;print "\n Distance in Meters :",$m;print "\n Distance in Centimeter : ",$cm;print...

View Article

Perl script for calculating average of five subjects

print "\n Enter Marks for the Following Subjects \n";print "\n English = ";$m1=<STDIN>;print "\n Tamil = ";$m2=<STDIN>;print "\n Maths = ";$m3=<STDIN>;print "\n Physics =...

View Article

Perl Program for converting temperature Fahrenheit to Centigrade

print "\n Enter the Temperature in (Fahreheit) : ";$fr=<STDIN>;$cent=(5/9)*($fr-32);print "\n Temperature in Fahreheit : ",$fr;print "\n Temperature in Centigrade : ",$cent;print "\n";

View Article


Swapping two numbers in perl

print "\n Enter Two Numbers 2 Interchange \n";$a=<STDIN>;$b=<STDIN>;print "\n Before Swapping";print "\n A = ",$a;print "\n B = ",$b,"\n";$e=$a;$a=$b;$b=$e;print "\n After Swapping";print...

View Article


Perl programm for calculating total population of men, women, literate,...

$totpop=80000;$totmen=((52*$totpop)/100);$totwomen=$totpop-$totmen;$totlit=((48*$totpop)/100);$totlitmen=((35*$totmen)/100);$totlitwomen=$totlit-$totlitmen;$totillit=$totpop-$totlit;$totillitmen=$totme...

View Article

Finding Factiorial of inputted number in perl script

print "Enter a Number for finding Factorial of it : ";chop($num=<STDIN>);$fact=1;for($i=1;$i<=$num;$i++){  $fact=$fact*$i;}print "Factorial Value of $num is : $fact \n";

View Article

Perl Script for sending Mail in LAN

#!/usr/bin/perl#print "Content-type: text/html\n\n";$title='Perl Mail ';$to='target mail id for LAN';$from= 'source domain';$subject='YOUR SUBJECT';open(MAIL, "|/usr/sbin/sendmail -t");## Mail...

View Article

Simple Directory Listing in Perl Script

   #!/usr/bin/perl    use strict;    use warnings;    my $dir = '/tmp';    opendir(DIR, $dir) or die $!;    while (my $file = readdir(DIR)) {        # Use a regular expression to ignore files beginning...

View Article


Recursive Directory Listing in Perl

#recursive directory listinguse strict;use File::Find;sub loadFiles(); #udfsub mySub(); #udfmy @files = ();my $dir = shift || die "Argument missing: directory name\n";loadFiles(); #callmap { print...

View Article

Perl script for creating a copy of a files

use strict;## This script takes two file names, and copies the first one to the second.#if($#ARGV != 1) {    print STDERR "You must specify exactly two arguments.\n";    exit 4;}# If the output exists,...

View Article


Perl Script for Sending Internet Mail

 use Net::SMTP::TLS;   my $mailer = new Net::SMTP::TLS(       Host    =>      'smtp.mail.yahoo.com',       Hello   =>      'mail.yahoo.com',       Port    =>      465,       User    =>...

View Article

Perl Script for Listing specific type of Files

#!/usr/bin/perl -w# create a list of all *.html files in# the current directoryopendir(DIR, ".");@files = grep(/\.html$/,readdir(DIR));closedir(DIR);# print all the filenames in our arrayforeach $file...

View Article


Perl script for open or create a file

unless(open(INFILE,"<sample1.pl")){   die("Cannot Open Input File sample.pl"); }unless(open(OUTFILE,"+>outfile.pl")){  die("Cannot Create Output File");}$line=<INFILE>;while($line){  print...

View Article

Perl script for Sending Messages from Way2SMS

#!/usr/bin/perluse WWW::Mechanize;use Compress::Zlib;my $mech = WWW::Mechanize->new();my $username = "yourmobileno"; #fill in username heremy $keyword = "Rajesh090684";  #fill in password here#my...

View Article

Perl Script to check free disk space and send mail

#!/usr/bin/perl -w# Script to check free diskspace and email notifications.  Change the email and alert levels and you should be good to go.#...

View Article
Browsing all 25 articles
Browse latest View live




Latest Images