#!/usr/bin/perl -w # perl 5.8 feature, open a scalar as a filehandle open my $fh, '>', \my $pod or die "Couldn't open filehandle: $!"; while () { print $fh $_ if /^=/ .. /^=cut/ } print $pod; __DATA__ # Some code my $foo = 'bar'; =head1 This is a B This is a paragraph. This is a verbatim section. This is I> paragraph =cut