Text file ========= Sandeep:1002:IST:him:email@provider Vishal:0603:IST:him:email@provider Aaradhna:2703:IST:her:email@provider Mallikarjun Gowda:2412:IST:him:email@provider Code Snippet ============ #!/usr/bin/perl -w use POSIX qw[tzset]; use POSIX qw(strftime); $ENV{'TZ'} = 'Asia/Calcutta'; tzset(); $clear_string=`clear`; print $clear_string; printf("\t\t\tIST TIMEZONE SET\n\n"); $datestring = strftime "%a %b %e %H:%M:%S %Y", localtime; printf("\tDate and time - $datestring\n"); $datecmp = strftime "%d%m", localtime; #This part reads the file line by line my $filename = '/home/srivasta/birthday.txt'; open (my $fh,'<:encoding(UTF-8)',$filename) or die "Could not open file '$filename' $!"; while (my $row = <$fh>) { chomp($row); my($birthdayperson,$birthdate,$timezone,$gender,$email)=split /:/,$row; if ($birthdate == $datecmp){ printf("\tBirthdayPerson name is $birthdayperson\n"); printf("\tBirthdate is $birthdate\n"); printf("\ttimezone is $timezone\n"); printf("\tGender is $gender\n"); printf("\tEmail is $email\n"); printf("\t$birthdayperson has birthday today"); printf("\n\tRemember to Wish $gender a very Happy Birthday\n"); # Below block of code sends mail to the intended Receipent open(MAILPIPE,'|/bin/mailx -s "Happy Birthday" email@provider') or die "Can't open pipe $!"; print MAILPIPE "Wishing you a Very happy Birthday. Enjoy the day\n"; close MAILPIPE; } } Sample Output ============= IST TIMEZONE SET Date and time - Thu Dec 24 14:18:46 2015 BirthdayPerson name is Mallikarjun Gowda Birthdate is 2412 timezone is IST Gender is him Email is email@provider Mallikarjun Gowda has birthday today Remember to Wish him a very Happy Birthday $ #### open(MAILPIPE,'|/bin/mailx -s "Happy Birthday" $email') or die "Can't open pipe $!"; Output ====== IST TIMEZONE SET Date and time - Thu Dec 24 14:32:03 2015 BirthdayPerson name is Mallikarjun Gowda Birthdate is 2412 timezone is IST Gender is him Email is email@provider.com Mallikarjun Gowda has birthday today Remember to Wish him a very Happy Birthday You must specify direct recipients with -s, -c, or -b.