SPUG: reg exp's
Jonathan Gardner
jgardn at alumni.washington.edu
Tue Sep 3 21:42:35 CDT 2002
On Tuesday 03 September 2002 10:36 am, Baker, Stephen M wrote:
> I need to parse quickly through a file of the following format:
>
> heading1: data1.1
> heading2: data2.1
> heading3: data3.1
>
> heading1: data1.2
> heading2: data2.2
> heading3: data3.2
>
> heading1: data1.3
> heading2: data2.3
> heading3: data3.3
>
#!/usr/bin/perl -w
use strict;
while (<>) {
/^(.*?):(.*)$/;
my $heading = $1;
my $data = $2;
... do your stuff ...
}
--
Jonathan Gardner
jgardn at alumni.washington.edu
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list