Re: Find duplicates in a dat file
- From: Tad McClellan <tadmc@xxxxxxxxxxxxxx>
- Date: Fri, 31 Mar 2006 10:30:03 -0600
Dr.Ruud <rvtol+news@xxxxxxxxxxxx> wrote:
The first two lines of my smaller Perl scripts often look like:
[snip]
The first four lines of all of my Perl programs look like:
#!/usr/bin/perl
# prog_name - what prog_name does
use warnings;
use strict;
Because then when I can't find a program I remember writing
a long time ago, I just run the program below to make an
index of all of my Perl programs.
------------------------------------
#!/usr/bin/perl
# perl_program_index - make an index of all of my Perl programs
use warnings;
use strict;
use File::Find;
@ARGV = '.' unless @ARGV; # default to current directory
find \&perl_programs, @ARGV;
sub perl_programs {
return unless -f and -x _ and -T _; # consider only executable text files
open PROG, $_ or die "could not open '$_' $!";
return unless defined(my $shebang = <PROG>);
return unless defined(my $comment = <PROG>);
close PROG;
return unless $shebang =~ /^#!.*perl/; # not a perl program
return unless $comment =~ /^#\s*(\w+) - (.*)/; # not properly commented
print "$2\n $File::Find::name\n\n";
}
------------------------------------
--
Tad McClellan SGML consulting
tadmc@xxxxxxxxxxxxxx Perl programming
Fort Worth, Texas
.
- Follow-Ups:
- Re: Find duplicates in a dat file
- From: Emmanuel Florac
- Re: Find duplicates in a dat file
- References:
- Find duplicates in a dat file
- From: Tami
- Re: Find duplicates in a dat file
- From: axel
- Re: Find duplicates in a dat file
- From: Emmanuel Florac
- Re: Find duplicates in a dat file
- From: Dr.Ruud
- Re: Find duplicates in a dat file
- From: Anno Siegel
- Re: Find duplicates in a dat file
- From: Dr.Ruud
- Find duplicates in a dat file
- Prev by Date: Re: exit status
- Next by Date: CGI and CSS question
- Previous by thread: Re: Find duplicates in a dat file
- Next by thread: Re: Find duplicates in a dat file
- Index(es):
Relevant Pages
|