On Fri, 14 Jun 2002 [EMAIL PROTECTED] wrote: > I have worked out a painstaking way that will work (at least in my > tests so far), but wanted to see a better way with some of that > obfuscated but powerfull code perl is famous for.
Does it _have_ to be obfuscated? > #!/usr/local/bin/perl -w > ## Make sure we have a cmdline arg > if(!$ARGV[0]){ > print "No cmdline argument given.. we need a directory name\n"; > exit; > } > ## Establish a target > $dir = shift; > ## Open our target dir and scoop all numberd filenames into an array > opendir(DIR,"$dir")|| die "Cannot open directory $dir: $!"; > @files = grep {/^[0-9]+$/} readdir(DIR); use Mail::Header; foreach my $message (@files) { open(FILE, "<$dir/$message") or next; my $header = new Mail::Header(*FILE); $header->unfold("X-Spam-Status"); $output{"$dir/$message"} = $header->get("X-Spam-Status"); } > ## Print out our findings in an orderly fashion > foreach $key (keys %output){ > print "$key\n"; > print "$output{$key}\n\n"; > } You can install Mail::Header with CPAN: perl -MCPAN -e shell install Mail::Header _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink _______________________________________________ Spamassassin-talk mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/spamassassin-talk