[tpm] Detecting failed matches

Antonio Sun antoniosun at lavabit.com
Mon Nov 21 09:54:25 PST 2011


What would $1 be when there is no match found?
How to detect failed pattern matches?

I want the program exit code to reflect the fact whether the pattern has
been found or not.
I tried to detect undef or empty string '', but all seemed doesn't work for

        $ret = $1;
    exit (defined($ret) ? 0 : 1);
    exit (defined($1) ? 0 : 1);

Please help.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20111121/cd041368/attachment.html>

More information about the toronto-pm mailing list