bus contention algo in perl