[Israel.pm] numbers extract

Yuval Yaari yuval at windax.com
Thu Jun 8 01:27:11 PDT 2006


Ernst, Yehuda wrote:
> how can i do it fast?
>   

Untested, and I'm sure it's not the fastest way to do it, but here goes:

open(FILE, "yourfile");
my $file = do {local $/; <FILE>}; # slurp :)
close(FILE);

while ($file =~ m/(?<==)(\d+)/g) {
    # Do whatever you want with $1
}

I hope your file's not huge ;-)

  ~Y



More information about the Perl mailing list