#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my @arr = qw( 10 10 20 0x47 1 30 45 45 ); my @converted = map /^0x/ && oct || $_, @arr; say for @converted;