hello friends, i am doing my final project in which i have chosen to operate electrical appliances through cell phone in which i am going to use Linux and Perl to connect to cell phone and so on.... i am little stuck in the Perl way,can't figure it out that how to use Perl to connect to cell phone and i am also beginner to Perl language please help me out....

Thanks in Advance.

5 Years
Discussion Span
Last Post by roswell1329

Instead of trying to figure out how to get a Linux system to connect to a phone with Perl, why not think of simply getting the phone to run the Perl script on the Linux system when you send an MMS or email from the phone?

For example, if you want to turn a light on from your phone, for example, you could send an MMS with the message "Light On" from your phone to an email address on your Linux system -- let's use "appliance_cmd@mylinuxbox.net". You could then use a program called Procmail that triggers the Perl script when the email is received. The Perl script then parses the message and runs the command "Light On". To actually turn the light on, the Perl script would probably be running some command for an X10 or Z-Wave module.


for this first of all i have to download procmail and install it on linux right...or can i do this on win xp


You can run Procmail from a Cygwin installation, but would probably make things overly complicated. If you have a Linux system, I would stick with that to keep things simple.

Once Procmail is installed, all you need to do is create a .forward file to point to the Procmail executable and a .procmailrc file in the home directory of the account that will receive the email messages from your phone that tells Procmail what to do with the email it receives. Here are some Procmail How-To links:


Here's what the .forward file should look like:

"|exec /usr/bin/procmail -f-"

Here's what your .procmailrc file will probably look like:


:0 H
| ~myacct/bin/run_phone_command.pl

Then your run_phone_command.pl Perl script just has to be set up to read the email, like this:

#!/usr/bin/perl -w

while (<>) {
  $incoming = $_;
  if ($incoming =~ /^Lamp (.*)/) {
    if ($1 eq "on") { 
      system("execute command to turn light on here");
    elsif ($1 eq "off") {
      system("execute command to turn light off here");

That should be enough to get you started.


In this case, you wouldn't need to have any kind of connection between the Linux machine and your phone. Your Linux machine would be acting as a simple server, and the phone is acting as a client using email as the protocol. You simply use your phone to send an email to your Linux system. ProcMail is always 'listening' for those email messages, and will kick-off your Perl script to do the actual work whenever an email is received.

If you want a real client/server relationship between your phone and your Linux machine, you would need to code something for both your phone and your Linux system, which might be too advanced at this point.

However, if you're still looking to try that, I know there is a port of Perl for the Android, and I'm sure there would be one for webOS and iOS as well since all 3 are based on the Linux kernel. You might be able to create a simple client with Perl for your phone which connects to a script on your Linux machine. I would use the superdaemon xinetd for simplicity.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.