lundi 31 mai 2021

perl if not executing

I have modified perl script. It reads status from external file and executes subroutine based on that status.

##!/usr/bin/perl

use strict;
use warnings;

my $filename1="/usr/local/tmp/status.txt";



my $StepInfo;
open Input, $filename1;
undef $/;
$StepInfo= <Input>;
close Input;
$/ = "\n";
print "value $StepInfo";


if ($StepInfo eq  "Fresh" ){
        print "step1";
}

if ($StepInfo eq  "stp_fail"){
        print "step2";
}

I set status stp_fail in status file and run the script, i get this output. it not executing the IF statement.

-bash-4.2$ ./test2.pl
value stp_fail

kindly help on what am I missing.

Aucun commentaire:

Enregistrer un commentaire