in reply to regexp match up to but not incliuding...
Here's one possible solution:
use strict; use warnings; while ( $_ = <DATA> and /^\.subckt/../^\w/ ) { last if /^\w/; print; } __DATA__ .subckt cct0 v0 v1 v2 v3 + v4 v5 v6 * useless comment + v7 v8 v9 + va vb x00 v0 v1 x0 cct1 .ends
This has the disadvantage of performing a couple of pattern matches on every line of the file read. However, it improves upon your snippet by jumping out of the loop the instant it detects the end of the data you're looking for.
Dave
|
|---|