01
- three cans
- one file
- three balls
02
- none
- yes coffee
03
####
- three cans
- one file
- three balls
####
my $number;
my $file = "INFO\\comments.txt";
my $copyfile = "INFO\\commentsCopy.txt";
open(FILE, "<", $file ) or die "Cannot read '$file': $!";
open(COPYFILE, ">INFO\\commentsCopy.txt" ) or die "Cannot read 'commentsCopy.txt': $!";
my $found=0;
while (){
if ($found) {
if (/^$number/) {
if (/^-/) {
print COPYFILE "$_\n";
$found = 0;
}
}
} elsif (/^$name/o) {
$found = 1;
}
}
close (COPYFILE);
close (FILE);