in reply to Loop Through Scalar Obtain Information With Regular Expression

Try using a regular expression to parse the information. You can capture values in a regular expression and use them in variables called $1, $2, etc. You can also use something like the following to loop through the matches.
my $x = "abcccabcccabbbb"; while ($x =~ /([ab])/g) { print "Found '$1'\n"; }
Run that code and you'll see what I mean.

Using those two hints, you should able to complete your homew task.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

  • Comment on Re: Loop Through Scalar Obtain Information With Regular Expression
  • Download Code