in reply to Print area between two lines within a file.
Well, I'm not sure if this is very idiomatic, but here's how I've done stuff like this in the past:
I just had to add the "or die" to your open....my $toggle = 0; # initially false open FH, 'file' or die "open fails: $!"; while (<FH>) { $toggle = !$toggle if /USE/; # Not sure why you'r removing backslashes, but.... # tr/\\//d would be faster, BTW s/\\//g; print if $toggle; } close FH;
HTH
|
|---|