René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

Matcing several times in a while-loop [Perl]

use strict;
use warnings;

my $text = "ϨϩϪϫϬ";

# Doesn't work:
#
# while ( (my $d) = $text =~ m/&#(\d+);/g) {
#   print "$d\n";
# }

while ( $text =~ m/&#(\d+);/g) {
  print "$1\n";
}
This prints:
1000
1001
1002
1003
1004