#!/usr/local/bin/perl -w use strict; use warnings; while () { chomp(); my $reg=""; $reg.="^[a-zA-Z0-9]+"; $reg.="\\s*"; $reg.="[^:]*::\\s*"; $reg.="([^ ]*\\s)?"; $reg.="([^(]*)"; $reg.="\\([^)]*\\)[{]?\$"; print "$2\n" if (/$reg/); } __DATA__ void CLASS1::Function0 (void){ } const void CLASS1::Function1 (void) { } const CLASS2::Type CLASS1::Function3 (void){ } std::vector& CLASS1::Function4 (void){ } const CLASS2::Type* CLASS1::Function5 (void){ } const std::string Class1::Member1 = "" " more data "; std::vector& CLASS1::Function4 (void){ foo = Class2::function(FOO,BAA); }