#!/usr/bin/perl use strict; use warnings; use Regexp::Common; while () { s|($RE{num}{decimal})%|$1 * 0.01|eg; print; } __DATA__ ENSP00000233379 1058 30 1206 1298 96.1% 13 + 96524483 96533474 8992 ENSP00000233379 1058 30 1206 1298 96% 13 + 96524483 96533474 8992 #### s|\b($RE{num}{decimal})%|$1 * 0.01|eg; #### if (/%/) { print STDERR "Input has been corrupted!"; # die ? }