$wholefile=~s/(pattern for table)/sub($&)/segx;