Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; my $regexp = qr{some regexp}o; open (FILE, 'some.file') or die "Can't open file.\n"; undef $/; my $file = <FILE>; close FILE; while ($file =~ /$regexp/g) { print "$1\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Best way to get all of the matches?
by prasadbabu (Prior) on Sep 30, 2006 at 11:23 UTC | |
by GrandFather (Saint) on Sep 30, 2006 at 18:26 UTC | |
|
Re: Best way to get all of the matches?
by McDarren (Abbot) on Sep 30, 2006 at 11:37 UTC | |
|
Re: Best way to get all of the matches?
by fmerges (Chaplain) on Sep 30, 2006 at 14:56 UTC | |
|
Re: Best way to get all of the matches?
by explorer (Chaplain) on Sep 30, 2006 at 11:21 UTC |