two simultaneous processes in perl

Posted on 2005-04-07
Last Modified: 2008-03-06
how can i set a timer to run in the background of my program withouth interrupting my main program?
basically i need to execute a function on my time every 5 seconds withouth interrupting the flow of my main program.

i have a menu that reads from the <stdin> and while waiting (or executing other functions) i need to execute the timer on the background.
I think that there should be two processes running at the same time, one for the timer and one for my menu

how can i do this? can i use fork???
Question by:jazz250
    LVL 18

    Accepted Solution

    Hi jazz250,
    > how can i do this? can i use fork???

    depends on the version of perl and the OS yoú're going to run this on. If OS eq Windows, then fork() and alarm() are almost completely unsupported. If perl < 5.8, then threads are mostly unreliable.

    LVL 2

    Author Comment

    fork finally worked fine for me... had some issues while trying to create more than 64 processes (even if i exit() them)


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (,  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
    Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now