#!/usr/bin/perl -s $usage = " -h show this help and exit -i number of answers first "; if ($h) {print $usage;exit} undef $/; for $file (<*.dat>) { open(File,$file) || die("could not open file $file ($!).\n"); for $t (split(/\n%\n/,)) { $t =~ s/(.*?)\n/ $top=$1;$ans=$' /e; $top =~ s/#//; $a = split(/\n/,$ans); print $i ? "$a - $file:$top\n" : "$file:$top - $a\n"; } close(File) }