in reply to no exit!

Is errmsg() returning a false value?

- tye        

Replies are listed 'Best First'.
Re^2: no exit! (return)
by doc1623 (Novice) on Aug 14, 2015 at 18:56 UTC
    You were right! Sorry Couldn't see the forest through the trees. I had it printing a string..not returning one!
    MATCHED IT insert value/count mismatch: no insert value entered Died at db.pl line 51, <FILE> chunk 1
    Thanks everyone... DOH.....
Re^2: no exit! (return)
by doc1623 (Novice) on Aug 14, 2015 at 17:45 UTC
    No...
    MATCHED IT insert value/count mismatch: no insert value entered pased*********************

      Please restructure your code as follows:

      if ($insql =~ m/.*~\w+~.*/) { print "MATCHED IT\n";} errmsg(1); die; };

      You don't show the code of errmsg, but most likely it really returns a false value and thus prevents the die from executing.

      If the left side of && is false, the right side will never be executed. Compare:

      This does not die...

      errstr() && die if (1); sub errstr { return 0; }

      This does:

      if (1){ errstr(); die; } sub errstr { return 0; }