# Read input a paragraph at a time # and put carriage returns on output lines local $/ = "\n\n"; local $\ = "\n"; # Read input, one question at a time while (<>) { chomp; # Grab the question number my $number = /^(\d+\.)/; # Split the question into lines my @question = split /\n/; # The answer is the last line my $answer = pop @question; # Send the results to different output streams print OUT1 join("\n", @question); print OUT2 "$number $answer"; }
buckaduck
In reply to Re: Two files from one.
by buckaduck
in thread Two files from one.
by ellem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |