Hi Dharshana,
2007/1/19, Dharshana Eswaran <[EMAIL PROTECTED]>:
Hi All,
I have a string as shown below:
$string =
"{[0]=0x53,[1]=0x65,[2]=0x63,[3]=0x75,[4]=0x72,[5]=0x69,[6]=0x74,[7]=0x79,[8]=0x43,[9]=0x6F,[10]=0x64,[11]=0x65,[12]=0x00}"
This is stored as a string in a variable. I need to pull out only the
numbers and store them in a array. Like:
@array = (53, 65, 63, 75, 72, 69, 74, 79, 43, 6F, 64, 65, 00);
I've achieved this results with the following code:
my @data = $string =~ m/0x(\d{2})/g;
I don't know if it is the most efficient way to do that.
HTH!
--
Igor Sutton Lopes <[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/