#!/usr/bin/perl STAGE1: while (1) { $l=system "pslist|grep process_name>!temp"; if ($l=="256") { sleep(1); } else { sleep(1); goto STAGE2; } } STAGE2: while (1) { $l=system "pslist|grep process_name"; # print "$l \n"; if ($l=~"256") { sleep(1); #Code 4 execution here unlink "!temp"; goto STAGE1; } else { sleep(1); } }