title: Debug a Perl script
body: <p>I already did some research on Perl script debugging but couldn't find what I was looking for.</p>
  
  <p>Let me explain my problem here.</p>
  
  <p>I have a Perl script which is not entering into last while loop it seems cos it is not printing anything inside as instructed.</p>
  
  <p>So, I want to know is there any easier method available to see all lines one by one like we can see in shell script using</p>
  
  <pre><code>set -x
  </code></pre>
  
  <p>Here is my Perl script code</p>
  
  <pre><code>#!/usr/bin/perl -w
  
  my $ZONEADM = "/usr/sbin/zoneadm list -c";
  
  use strict;
  use diagnostics;
  use warnings;
  
  system("clear");
  print "Enter the app\n";
  chomp(my $INS = &lt;&gt;);
  
  print "\nEnter the Symmitrix ID\n";
  chomp(my $SYMM = &lt;&gt;);
  
  print "\nEnter the Server\n";
  chomp(my $SRV = &lt;&gt;);
  
  print "\nEnter the devices\n";
  while (&lt;&gt;) {
    if($_ !~ m/(q|quit)/) {    
      chomp($_);
      my $TEMP_FILE = "/export/home/ptiwari/scripts/LOG.11";
      open (my $FH, '&gt;&gt;', $TEMP_FILE);
      my @arr = split(/:/, $_);
      if($arr[3]) {
        print $FH "/".$INS."db/".$arr[0]."  ".$SYMM."  ".$arr[1]."  ".$arr[2]."  ".$arr[3]."\n";
      }
      else {
        print $FH "/".$INS."db/".$arr[0]."  ".$SYMM."  ".$arr[1]."  ".$arr[2]."\n";
      }
      undef @arr;
      close $FH;
    }
    else {
      exit;
    }
  }
  
  my $IS_ZONE = qx($ZONEADM|grep -i $SRV|grep -v global);
  if($IS_ZONE) {
    $IS_ZONE = "yes";
  }
  else {
    $IS_ZONE = "no";    
  }    
  
  open(my $FLH, '&lt;', "/export/home/ptiwari/scripts/LOG.11");
  my @lines;
  while(&lt;$FLH&gt;) {
    my ($GLOBAL_MTPT, $SYM, $SYM_DEV, $SIZE, $NEWFS) = split;
    print $GLOBAL_MTPT."  ".$SYM."  ".$SYM_DEV;
    print "\n";
  }
  </code></pre>
  
  <p>I already tried <code>perl -d</code> but it didn't show me anything which can help me to troubleshoot why it didn't enter the while loop.</p>