$job_id = uc $job_id; $job_id =~ s/^(..)(..)(..)(..) # Invert first 4 bytes (..)(..) # More comments ... (..)(..) (.{4}) (.{12}) $ /$4$3$2$1-$6$5-$8$7-$9-$10/x;