[EMAIL PROTECTED] am Freitag, 2. Juni 2006 09:27:
> Hi,

Hi

> I'm currently trying to find a good way to modify a string. A program
> returns me a MAC address under the form 0a0a0a0a0a0a, and I would like to
> tranform it to obtain : 0a:0a:0a:0a:0a:0a
[...]
> All my difficulties is to "populate" correctly the delimiter, and to be
> honest I begin to have doubt about the fact split is appropriated.
>
> Thanks for help

another one:

#!/usr/bin/perl
use strict; use warnings;

my $s='0a0a0a0a0a0a';

# eventually check input:
$s=~/^[[:xdigit:]]{12}$/ or die "wrong format of '$s'!";

print join ':', $s=~/^([[:xdigit:]]{2})$/g;


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to