title: Perl: Syntax error near unexpected token `|'
body: <p>I am newbie to perl ,</p>
  
  <p>I am tring to get the valid date from keystore using keytool.</p>
  
  <p>Sample code :</p>
  
  <pre><code>my @test = `cd /usr/keystores; find . -name '\*\_old\_id\.jks'`;
  print "@test";
  
  my @fus_res=();
  
  s/\.\///g for @test;
  print "@test";
  
  
  foreach $res(@test)
  {
   my $short =substr($res,0,-14);
  
   push(@fus_res,$short);
  }
  
  
      foreach my $j(0 ..$#fus_res) {
          foreach my $i(0 .. $#test) {
              if ($i eq  $j) {
                  my $finali="$test[$i]";
                  my $finalj="$fus_res[$j]";
                  my @test1=`cd /usr/keystores;keytool -list -v -storepass "2xxpw" -alias $finalj -keystore $finali | grep Valid `;
                  print "test_final=@test1";
              }
          }
      }
  </code></pre>
  
  <p>But keystore command is working , for grep part getting error as :</p>
  
  <pre><code>sh: -c: line 1: syntax error near unexpected token `|'
  sh: -c: line 1: ` |grep Valid '
  </code></pre>
  
  <p>Please suggest what mistake in this sample code </p>