#!/usr/bin/perl

use so;
use Data::Dumper;


while(<>){
  chomp;
  if($_) { print join("\n", map {Dumper($_)} so::get("man -k $_|",{max=>10,function=>\&f}));}
}

sub f{
  my $a=shift;
  if ($a =~/((?:\w|[:.])+)\s+\((.*?)\)\s*\-/) {
      +{name => $1, section => $1, sem =>$'}}
  else{ "....$a"} 
}
