[PLUG] Perl question
Paul Heinlein
heinlein at attbi.com
Mon Jun 23 16:03:02 UTC 2003
On Mon, 23 Jun 2003, Colin Kuskie wrote:
> use strict;
> @phone = ();
> my $phone;
> while (<INFILE>) {
> if (($phone) = /(\d\d\d \d\d\d\d)/) {
> push @phone, $phone;
> }
> }
Or, get the same list using grep, in a locale-independent way:
grep -Eo '[[:digit:]]{3}[[:space:]][[:digit:]]{4}' infile.txt
Why? Just because you can. :-)
--Paul Heinlein <heinlein at attbi.com>
More information about the PLUG
mailing list