PerlTemplate
<perl>
- ! /usr/bin/perl -w
- *************************************************************
- This Programme does the following in sequence
- ->
- ->
- Author: Rajkumar (itc@rajkumar.in)
- *************************************************************
- Libraries
use strict; use DBI;
- At the top: Time Start
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
- Variables
my $path = ""; my @file = @_;
- Connecting to the database
my $dbh = DBI->connect('DBI:mysql:database:host', 'usr', 'pwd') or die $!;
- Reading a file line by line
foreach my $line (split ("\n", `cat $path/file`))
{
}
- Open a dir
opendir (DIR, "$path") or die $!; @files = readdir(DIR); close(DIR);
foreach my $file(@files) { next if ($file eq "." or $file eq "..");
print $file."\n"; }
- Parse CSV
open(CSV_FILE, "parse_me.csv") or die "unable to open file 'CSV_FILE': $!\n"; <CSV_FILE>; # skip header line while (<CSV_FILE>){ ($column1, $column2, $column3, $column4) = split(/\t+/, $_); }
- Open a file
open (GFF, ">>".$file.".gff"); print GFF $gffout; close GFF;
- At the End: Time Calculation
my ($sec_,$min_,$hour_,$mday_,$mon_,$year_,$wday_,$yday_,$isdst_) = localtime(time); my $days = $mday_-$mday; my $hours = $hour_-$hour; my $mins = $min_-$min; my $secs = $sec_-$sec; print "\n------------------------\nDuration: "; if ($days>0) { print "$days days";} if ($hours>0) { print ": $hours hours";} if ($mins>0) { print ": $mins mins";} if ($secs>0) { print ": $secs secs";} print "\n------------------------\n";
- END
</perl>