Help for this page

Select Code to Download


  1. or download this
    0:13:46:b:4:31    # input
    00:13:46:0b:04:31 # expected output
    
  2. or download this
    $mac =~ s/(^|:)([\da-f])(:|$)/${1}0${2}${3}/g;
    
  3. or download this
    0:13:46:b:4:31    # input
    00:13:46:0b:4:31  # produced
    00:13:46:0b:04:31 # expected
    
  4. or download this
    my @parts = split /:/ , $mac;
    foreach (@parts) { if (length == 1) { $_ = "0" . $_; } }
    $mac = join ":" , @parts;