in reply to Re^6: Multi-line regex help needed
in thread Multi-line regex help needed
Well, I have two things to say to that. First, you get what you ask for if you make assumptions about the knowledge of the people helping you. Second, the first time I mentioned $ not really being there should have been an indication to you that I didn't know what I was talking about. In any event, here is a working proof of concept since you have had to suffer through my ignorance.
#!/usr/bin/perl use strict; use warnings; my $file = $ARGV[0] || 'foo.txt'; open(my $fh, '<', $file) or die "Unable to open '$file' for reading: $ +!"; my $buffer = ''; while (<$fh>) { if (/^\S+domain\.com$/) { process_buffer($buffer); $buffer = $_; next; } $buffer .= $_; } sub process_buffer { my ($section) = @_; print "================BLAH================\n$section\n"; }
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Multi-line regex help needed
by vxp (Pilgrim) on Jun 18, 2009 at 17:52 UTC |