DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Tidy Up Copy'n'paste Code Snippets From DZone
// remove the line numbers from DZone's copy'n'paste code snippets
#!/usr/bin/perl
#
# usage : dzone.pl copy_and_paste_file
# copy_and_paste_file - file which contain the code snippet from DZone website
sub dzone_tidy {
my ($infile) = @_;
open(FILE, "< $infile") || die "ERROR: failed to open file: '$infile'";
while (my $line = <FILE>) {
$line =~ s/^[ ]*[0-9]* //;
print "$line";
}
close(FILE);
}
if ( $#ARGV ne 0 )
{
print "ERROR: wrong number of parameters\n\n";
exit(1);
}
my $infile = $ARGV[0];
dzone_tidy(${infile});






Comments
Brian Tully replied on Tue, 2008/12/09 - 3:42pm