in reply to Mactching arrays and reg. exp.

HEAD
  .
  .
  .
TAIL
and ends with suppose 
America 331
If your file looked something like what is above, you could do the following:
my $read = 1; my @output; foreach my $line (@array){ if($line =~ /HEAD/){ $read=0; } elsif($line =~ /TAIl/){ $read=1; } push @output, $line if $read; }
--eric

Replies are listed 'Best First'.
RE: Re: Matching arrays and reg. exp.
by davorg (Chancellor) on Aug 03, 2000 at 19:14 UTC
      Thank you guys, but I am trying to match the arrays here. If I want define 7 then it should recognize array 7 of another file and print some thing like
      define 7 thankx(#came from another file)
      . I couldn't find anywhere.
      Thankx.