#! perl -slw use strict; use re 'eval'; my $re_sub = qr[ sub\s+ ( (?: (\w+)? (?: :: | ' ) )* \w+ \s* ) (?{ $name = $^N }) ( (?: \( [&$@\\; ]+ \) )? \s* ) (?{ $prototype = $^N || '' }) ( (?: : \s* \w+ (?: \( .+? \) )? \s* )* ) (?{ $attributes = $^N || '' }) \{ ]x; BEGIN{ @ARGV = map{ glob } @ARGV if $^O eq 'MSWin32'; } our( $name, $prototype, $attributes ); local $/ = undef; while( <> ) { tr[\n][]; s[\s+][ ]g; printf "%-40s : Name: %-20s\tPrototype: %10s\n\tAttributes : %s\n", $ARGV, $name, $prototype, $attributes while m[$re_sub]g; }