Time To Earn

Showing posts with label Perl Scripting Tips. Show all posts
Showing posts with label Perl Scripting Tips. Show all posts

Saturday, August 24, 2013

Disable Warning in Perl

Simple... use below line in the subroutine if you have used "use warnings" in the top of your programm.

no warning;

Perl Take Error and Output in one file


sub executeCommand
{
  my $command = join ' ', @_;
  ($? >> 8, $_ = qx{$command 2>&1});
}

my ($status, $output) = executeCommand ('/bin/ls', '/');