#!/usr/bin/perl -l # Call the program as follows: # perl toc.pl perlop # perl toc.pl Parse::RecDescent my $podfile = `perldoc -l @ARGV[0]`; exit if $?; open POD, $podfile or die "$podfile: $!.\n"; while () { print " " x ($1-1), $2 if /^=head(\d)\s+(.*)/; }