vineet2004 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: looping prob
by ysth (Canon) on Dec 29, 2006 at 07:33 UTC
Re: looping prob
by blazar (Canon) on Dec 29, 2006 at 09:46 UTC
    perl -e 'while (my $var= <STDIN>) { $run ="awk -f work_5messages.awk /home/gprs/newvanu/Hull-r54283_Run/l +ogs/$var >logfile.log" ;`$run`; }'

    Take from Re: shell prob, of which I underlined at least a shortcoming.

    the above is a (bash)shell script program.....the above code executes $run on the shell only once.....

    The above is not a shell script, it' a Perl script. The above executes $run with a different value taken from STDIN each time you feed it something on STDIN, until you end it with CTRL-D.

    i want $run to be executed after every 2 sec.....how do i set this timer........

    either read perldoc -f sleep or perldoc -f alarm.

    and i want this loop to be infinite...but then how can i exit out of it on the prompt.

    while (1) { ... }; and I don't understand the prompt thing.

    you guys have been very kind to me so far....just one last favor.. vineet

    Just one last favour: please do not start new threads for stuff that fits in previous ones!