in reply to Using a Sub to pull info. from a Text File
Now, in doing that (example works well with email message or raw web data, header is terminated by blank line, rest is body info) younow have the header as one string, and the body as another, and can pass these off to subroutines... but that is just one way to do it.open(DATA, '/tmp/file') or die $!; $header = 1; while(<DATA>) { $header = 0 if(/^$/); if($header) { $header .= $_; } else { $body .= $_; } } close DATA;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Using a Sub to pull info. from a Text File
by sierrathedog04 (Hermit) on Apr 11, 2001 at 01:04 UTC | |
by tye (Sage) on Apr 11, 2001 at 19:53 UTC | |
by suaveant (Parson) on Apr 11, 2001 at 16:32 UTC |