[Za-pm] Script

Spike spikeh at mweb.co.za
Wed Jun 4 07:16:08 CDT 2003


I see your use of perldoc entries - nice.
Is there a simple way to force perldoc to launch if the user enters 
./myscriptwithdoc --help?

something like:

if ($ARGV[0] =~ /help/i)
{
system("perldoc $0");
}





>=head1 NAME
>
>get_email.pl - quick script to extract email addresses from SMS log
>
>=head1 SYNOPSIS
>
>   get_email.pl [smslog ...]
>
>=head1 DESCRIPTION
>
>Parses SMS log files to extract a list of user email addresses, and
>prints them to STDOUT one per line.
>
>=cut
>
># A regular expression to match a reasonable looking email address
>my $email = qr#[\w\-\.]+\@[\w\-\.]+#;
>
>while(<>) {
>     chomp;
>
>     unless ( /^\[([\w\s:]+)\] SMS\s+(.+?)\s+sent \d+ characters to 
> \d+\s*$/ ) {
>         warn "Can't parse log line [$_]\n";
>         next;
>     }
>     my ($date, $addr) = ($1, $2);
>
>     # We're only interested in May
>     next unless $date =~ / May /;
>
>     if ( $addr =~ /<($email)>$/ or $addr =~ /^($email)$/ ) {
>         print "$1\n";
>     }
>     else {
>         warn "Can't parse address [$addr] at log line [$_]\n";
>     }
>}
>
></snip>
>
>--
>Nick
>_______________________________________________
>Za-pm mailing list
>Za-pm at mail.pm.org
>http://mail.pm.org/mailman/listinfo/za-pm


Spike Hodge

UNIX Programmer
M-Web Technology
021 596 8496
082 901 5265

Click here and make M-Web your homepage
http://homepage.mweb.co.za 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/za-pm/attachments/20030604/6b4fccfb/attachment.htm


More information about the Za-pm mailing list