Name
$#
Synopsis
Because the RHS can return a delivery-agent specification, it is
sometimes desirable to check for the $# operator
on the LHS of a rule. Consider, for example, the following rule:
R $+ $| $# OK $@ $1
The LHS looks for anything (the $+) followed by a
$| operator, and then a $# OK.
This might match a workspace that was set up by a database-map lookup
or a call to another rule set. The $# OK means the
address was OK as is, and so should be placed back into the
workspace. The RHS does just that by returning (the
$@ prefix) the original address (the
$1 references the LHS $+, which
contained the original address).
Note that the $# operator has no special meaning
in the LHS. It is used only to detect a delivery-agent-like
specification made by an earlier rule on the RHS. The next two
sections reveal how this is done.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access