I would do it something like this:
use strict; use warnings; sub slurp { my $file = shift; open( my $fh, '<', $file ) or die "error: open '$file': $!\n"; local $/ = undef; my $s = <$fh>; close($fh); return $s; } my $file = shift or die "usage: $0 filename\n"; my @m = slurp($file) =~ /^=begin[^\n]*\n(.*?)^=end/msg; print "---\n$_---\n\n" for @m;
In reply to Re: Regular expression...
by eyepopslikeamosquito
in thread Regular expression...
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |