in reply to Design hints for a file processor
#!/usr/bin/perl use strict; use warnings; for (<DATA>){ if (m/^\s*Category (.*)$/){ print $1, $/; } }
If you want to really parse the file, I'd recommend a simple recursive descending parser, see Parsing with Regexes and Beyond for an explanation. The tokens would be just the lines.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Design hints for a file processor
by PhilHibbs (Hermit) on Jul 07, 2008 at 12:18 UTC | |
by moritz (Cardinal) on Jul 07, 2008 at 12:32 UTC | |
by PhilHibbs (Hermit) on Jul 07, 2008 at 13:13 UTC | |
by moritz (Cardinal) on Jul 07, 2008 at 13:21 UTC | |
by PhilHibbs (Hermit) on Jul 09, 2008 at 12:51 UTC |