title: Passing variable between scripts
body: <p>I've created a variable $date in Main.pl script that I would like to pass to Annotator.pl script. I use shell script to execute Annotator.pl.  I can't figure out how to pass $date to Annotator.pl. When I run <code>my $date = $ARGV[0];</code> in Annotator.pl I get the name of the current directory, however, <code>$date = $ARGV[1];</code> returns nothing.</p>
  
  <p>Please see the code below. The date is important because it has to be exact and I can't figure out how to pass it to Annotator.pl. Thanks for your help.</p>
  
  <p>Main.pl Script:</p>
  
  <pre><code>#!/usr/bin/perl -w
      use strict;
      use warnings;
  
      my $sec; my $min; my $hour; my $mday; my $mon; my $year; my $wday; my $yday;    my $isdst;
      ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
      $mon=$mon+1; $year = 1900+$year;
      if (length($mon)==1) {$mon="0".$mon;}
      if (length($mday)==1) {$mday="0".$mday;}
      if (length($hour)==1) {$hour="0".$hour;}
      if (length($min)==1) {$min="0".$min;}
      if (length($sec)==1) {$sec="0".$sec;}
  
      my $date = "$mon"."_"."$mday"."_"."$year"."-".$hour.$min.$sec;
  
      my $cmd5 = `perl MDL_unzip_annotate.sh /data/test_all_runs pVCF $date`;   print "$cmd5";
  </code></pre>
  
  <p>Shell script: MDL_unzip_annotate.sh that executes Annotator.pl</p>
  
  <pre><code>home="/data/test_all_runs" #location of the run directory from which the program is launched
     scripts="/data/test_scripts"  
  
       datapath=$1 #this is called in Main.pl as [test_all_runs]
       process=$2 #the process  
  
      if [[ "$process" == "pVCF" ]];then
              cd $datapath
              folders="$(ls)"
              cd $scripts
          for ff in $folders; do
              dname=$ff
                  echo $dname
                  if [  ! -f $dname ];then
  
                      cmd2="perl Annotator.pl $dname"
                      echo $cmd2
  
                      cmd2=`perl Annotator.pl $dname`
                      echo $cmd2
                  fi
              done    
      done          
  
      fi
  </code></pre>
  
  <p>Annotator.pl script:</p>
  
  <pre><code>#!perl
      use strict;
      use warnings;
  
      my $date = $ARGV[1]; print "the date is######## ".$date."\n";
  </code></pre>