in reply to How to parse text file with clear delimiters: regex? split?
#!/usr/bin/perl { local $/ = "-----\n"; while(my $note = <DATA>) { my($month, $day, $year, $time, $body) = $note =~ m#^(\d{2})/(\d{2})/(\d{4})\s+(\d{2}:\d{2})\s*\n(.*)#s; } } __DATA__ 04/01/2002 19:57 FOOBARS >>my favorite candy by far! yummy! ----- 04/03/2002 07:34 Ooh, it looks as if it might rain tomorrow. note to self {buy buy buy!} ----- 04/12/2002 12:02 Energy X invasion point++ ----- 04/12/2002 12:56 Crisis resolved (that was fun!) -----
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: I need help parsing this text file!
by Kanji (Parson) on Apr 02, 2002 at 02:19 UTC | |
|
Re: Re: I need help parsing this text file!
by belg4mit (Prior) on Apr 02, 2002 at 01:29 UTC |