move from agrep-based to perl