#!/usr/bin/env perluse warnings;use strict;use getopt::long;use findbin qw ($Bin); use File::basename QW (Basename); File::spec::functions QW (rel2abs); ##### Main Program # # # # #my $mainPL = basename ($); my $ysbin = "$Bin/ysbin";&main; Exit;sub Main{&usage if (@ARGV < 1), my $command = Shift (@ARGV), My%func = ("venn" = = \&venn,); if (!defined ($f unc{$command}) {warn ("\n\tunknown command: \" $command \ "\ n"); &usage;} &{$func {$command}};} Sub Usage{die (qq/usage: $mainPL <command> [Options]command:venn draw Venn pics and get Venn matrix of Sampl es.\n/);} ##### Sub Program # # # # # #sub Venn{my $pl = "Perl $ysbin/venn.pl"; my $help; GetOptions ("help|h" = \ $help,);d ie ' $PL 2>&1 ' if ($help);d ie (qq/usage: $mainPL Venn <files> <labels >notes:1. Need R and Venndiagram package of R2. <files> means a, b,... (2~5 files); <labels> means x, y,... (2~5 labels) Options:-help|-hsee The detail help information about venn\n/) if (@ARGV! = 2); &runsh ("$pl-f $ARGV [0]-L $ARGV [1] ");} Sub Runsh{my ($SH) = @_;&showtime ($sh); ' $sh '; &showtime ("Task is completed~");} Sub Showtime{my ($text) = @_;my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime;my $format _time = sprintf ("[%d-%.2d-%.2d%.2d:%.2d:%.2d]", $year +1900, $mon +1, $mday, $hour, $min, $sec);p rint STDERR "$format _time $text \ n ";}
Perl formatting templates