Re: Modifying a string

2006-06-02 Thread D. Bolliger
[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

Re: Modifying a string

2006-06-02 Thread Dr.Ruud
[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

Re: Modifying a string

2006-06-02 Thread Chandru
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

Re: Modifying a string

2006-06-02 Thread Wijaya Edward
> > 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=~ /(..

Re: Modifying a string

2006-06-02 Thread Wijaya Edward
> 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