in reply to Extract lines of .java

The easiest solution is probably using module Text::Balanced. Untested code:
use Text::Balanced qw(extract_codeblock); # get source code in this variable my $source = ....; # regexp finds where method is defined and sets "pos" (see perldoc -f +pos), # than extract_codeblock extracts following codeblock if($source =~ /public \s+ void \s+ readExternal \s+ \( .*? \) \s+ /gx) + { my $sub_source = extract_codeblock($source); print $sub_source; }

--
Ilya Martynov, ilya@iponweb.net
CTO IPonWEB (UK) Ltd
Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net
Personal website - http://martynov.org