in reply to Extraction of numbers in an string

t-rex, you will have to try a bit harder with your posts. With 47 posts, you've been around long enough that by now you should have at least mastered some of the syntax and terminology.

I have the following string: A1=<m,n>:<p,q>:<s,t>...go on
I have to extract values m,n,p,q,s,t from the above array.
How do i do it

After 6 months here you haven't achieved any enlightenment as to where to start?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Etxraction of numbers in an array
by t-rex (Scribe) on Nov 24, 2016 at 13:16 UTC

    I understood your point, I code mostly in assembly language and have to use perl intermittently with harsh deadlines, so I accept i posted this hastily, now I have corrected my post, please have a look, sorry for inconveneince

      I'd do it this way:

      #! perl -sw use strict; my $string = "<1,2>:<5,7>:<3,0>"; my @x = $string =~ m[<(\d+),(\d+)>]g; print "Extraction = @x\n"; print "1st element = $x[0]"; __END__ c:\test>junk Extraction = 1 2 5 7 3 0 1st element = 1

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority". The enemy of (IT) success is complexity.
      In the absence of evidence, opinion is indistinguishable from prejudice.