I have two files one unzipping.pl and another Main_Start_File.pl. I am calling unzipping.pl from Main file ... problem is that when i uncomment the commented part of Main file it is not executing unzipping.pl whereas when i run it with commented part it is going to unzipping and unzipping all file below is my code

main_file.pl #!/usr/bin/perl use strict; use warnings; use Net::FTP::Recursive ; require "unzipping.pl"; my $host = "xx.xx.xx.xx"; my $user = "tt"; my $password = "tt"; my $basedir = "locations"; my$reportfldr = "reports"; my $filename = 'List.txt'; my $date = "20161128"; #my $brchid="b00330"; ############Fetching report from Server#################### open(my $fh, '<:encoding(UTF-8)', $filename)or die "Could not open fi +le '$filename' $!"; while ( my $brchid = <$fh>) { chomp $brchid; print "$brchid\n"; # system "mkdir $brchid"; # chdir($brchid); # system "mkdir $date"; # chdir ($date); # my $dir = join"/",$basedir,$brchid,$reportfldr,$date; # my $f = Net::FTP::Recursive->new($host,Debug => 0) or die "Can't + open $host\n"; # $f->login($user, $password) or die "Can't log $user in\n"; # $f->binary(); # $f->cwd($dir) or die "Can't cwd to $dir\n"; # $f->dir(); # $f->rget(); # $f->quit; # print " I am entering into subroutine \n"; &unzipping($brchid,$date); # sleep 5; # chdir "../.."; } unzipping.pl #!/usr/bin/perl use strict ; use warnings ; use IO::Uncompress::Gunzip qw(gunzip $GunzipError); sub unzipping{ my $brchdir = $_[0]; my $date = $_[1]; my $dir1 = "Transaction_Reports"; my $dir2 = "Reports_On_Request"; my $dir3 = "Other_Reports"; my $dir4 = "MIS_Reports"; my $dir5 = "Letters_Reminders"; my $dir6 = "Exception_Reports"; my $dir7 = "Concurrent_Audit_Reports"; my $dir8 = "Adhoc_Audit_Reports"; my $dir = $brchdir."/".$date; print "I m in unzipp dir $dir \n"; my $dirf=$dir."/".$dir1; my $dirs = $dir."/".$dir2; my $dirt = $dir."/".$dir3; my $dirft = $dir."/".$dir4; my $dirfv = $dir."/".$dir5; my $dirsx = $dir."/".$dir6; my $dirsn = $dir."/".$dir7; my $direi = $dir."/".$dir8; print "I m here \n" ; print " $dir"; for my $input ( glob "$dir/*.gz" ) { print " I m inside for $dir \n"; my $output = $input; $output =~ s/.gz// ; gunzip $input => $output or die "Error Uncompressing '$input': $GunzipError\n"; } } 1;

In reply to Not able to execute perl sub routine by sachin raj aryan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.