Loading ...
Sorry, an error occurred while loading the content.

please check what wrong in this perl

Expand Messages
  • ilayar
    #!/usr/bin/perl -w use strict; use warnings; use Image::Magick; my @out; my $path = $ARGV[0]; my @tifFiles = &GetFiles($path); foreach my $tifFile(@tifFiles) {
    Message 1 of 2 , Jul 14, 2012
    • 0 Attachment
      #!/usr/bin/perl -w

      use strict;
      use warnings;
      use Image::Magick;
      my @out;

      my $path = $ARGV[0];

      my @tifFiles = &GetFiles($path);

      foreach my $tifFile(@tifFiles)
      {
      my $pdfFile=$tifFile;
      $pdfFile =~s#\.tif#\.pdf#gsi;
      my ($image, $rv);
      $image = new Image::Magick;
      if ($image)
      {
      $rv = $image->read($tifFile);
      warn "$rv" if "$rv";
      $rv = $image->Write($pdfFile);
      warn "$rv" if "$rv";
      }
      }



      sub GetFiles
      {
      my ($path) =@_;
      $path .= '/' if($path !~ /\/$/);

      foreach my $eachFile (glob($path.'*'))
      {
      if( -d $eachFile)
      {
      GetFiles($eachFile);
      }
      else
      {
      if($eachFile =~m#\.(tif)#si)
      {
      push(@out, $eachFile);
      }
      }
      }
      return @out;
      }
    • Charles K. Clarkson
      What leads you to believe something is wrong? Are you getting a different result than you expect? What are you getting? What are you expecting? Are you getting
      Message 2 of 2 , Jul 14, 2012
      • 0 Attachment
        What leads you to believe something is wrong?

        Are you getting a different result than you expect?
        What are you getting?
        What are you expecting?

        Are you getting errors?
        What are the errors?

        Please be very specific.


        Charles Clarkson
        --
        I'm not really a smart person. I just play one on the Internet.
        +1 (254) 434-2733
      Your message has been successfully submitted and would be delivered to recipients shortly.