[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" c
[EMAIL PROTECTED] schreef:
> 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
>
> I found a such dirty way !! (I think) to do this job :
>
> my $mac = '0a0a0
Hi mick
try this
#!/usr/bin/perl -w
my $mac = '0a0a0a0a0a0a';
$mac=~ s/(..)/$1:/g;
chop($mac);
print $mac;
- Chandru
[EMAIL PROTECTED] wrote:
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 tr
> > 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
> >
>
>
> Try this:
>
> $ perl -e '$str = "0a0a0a0a0a"; $str2 =join(":",$str=~ /(..
> 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
>
Try this:
$ perl -e '$str = "0a0a0a0a0a"; $str2 =join(":",$str=~ /(..)/g); print