Perl: the Markov chain saw | |
PerlMonks |
Re^5: Extract lines between two patternsby philipbailey (Curate) |
on Jan 22, 2012 at 09:38 UTC ( [id://949237]=note: print w/replies, xml ) | Need Help?? |
Please don't ignore requests to use <code> tags. You can edit your posts and add them. Having posted runnable code, the issues become more obvious: you open file "block.power" for writing, not reading--so use "<", not ">" (and you don't test whether the open succeeds). Your while loop loops infinitely over "$fh", which is always true; you should say while (<$fh>) {, which actually reads from the filehandle. The undefined variable in the pattern match is in fact $_.
In Section
Seekers of Perl Wisdom
|
|