N. Ganesh Babu wrote:
Dear All,

Hello,

input:

<aud=1-3>T
<cpn=1-3,4,5,6-10>6
<bnd=1-3>TC

output

<aud=1,2,3>T
<cpn=1,2,3,4,5,6,7,8,9,10>6
<bnd=1,2,3>TC

How can it be achieved in regular expression?. Or any other means is easy. I am trying to put the coding of for loop inside substitution string with (?{...}) but it is not working.

$ perl -le' $_ = q/<cpn=1-3,4,5,6-10>6/; print; s/(\d+)-(\d+)/join ",", $1 .. $2/eg; print; ' <cpn=1-3,4,5,6-10>6 <cpn=1,2,3,4,5,6,7,8,9,10>6




John -- use Perl; program fulfillment

--
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