Will this help?
open (INFILE, 'ads.txt' ) or die "Error opening file ($!)"; my @ad_lines = (); while ( <INFILE> ) { s/^\s+|\s+$//g; # Chop off leading, trailing space next unless $_; # Skip empty lines last if /\/\-+advertisement/; push( @ad_lines, $_ ) if /^\s*\d+\./; } # Do whatever with @ad_lines .... print join( "\n", @ad_lines ), "\n"; close INFILE; [sathish] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]