$str = '004asdfsa'; #string starting with zero and followed by numbers $str =~ s/^0+(?=\d)//; print $str; Output: -------- 4asdfsa #### $str = 'a004asdfsa'; #not starting with zero $str =~ s/^0+(?=\d)//; print $str; Output: -------- a004asdfsa #### $str = '0a4sdfsa'; #no number followed by zero $str =~ s/^0+(?=\d)// ; print $str; Output: -------- 0a4sdfsa