if ($main::stateIn{'sibling'}) { no strict 'refs'; &{$main::stateIn{'sibling'}}(); } #### #!C:/perl/bin/perl.exe -w use strict; open INV, "<$ARGV[0]" or die $!; open OUT, ">out.txt" or die $!; print OUT "SWITCH: {\n if ( defined \$sibling ) {\n"; while ( ) { if ( /^\s*sub\s+([a-zA-Z][^\s{]+)/ ) { next if $1 eq 'AUTOLOAD' or $1 eq 'main'; print OUT " if ( \$sibling eq '$1' ) { &$1; last SWITCH };\n"; } } print OUT "\n\n &main;\n last SWITCH;\n }\n"; close INV; close OUT; #### SWITCH: { if ( defined $sibling ) { if ( $sibling eq 'uFMProducts' ) { &uFMProducts; last SWITCH }; if ( $sibling eq 'catalogDealerProducts' ) { &catalogDealerProducts; last SWITCH }; if ( $sibling eq 'prodByCatalog' ) { &prodByCatalog; last SWITCH }; if ( $sibling eq 'catalogProductView' ) { &catalogProductView; last SWITCH }; if ( $sibling eq 'catalogProductUpdate' ) { &catalogProductUpdate; last SWITCH }; if ( $sibling eq 'dealerProducts' ) { &dealerProducts; last SWITCH }; if ( $sibling eq 'categoryDetail' ) { &categoryDetail; last SWITCH }; if ( $sibling eq 'prodByCategory' ) { &prodByCategory; last SWITCH }; . . . &main; last SWITCH; }