I did not say that your code was "incorrect". What I did say was that ? : is usually used as an rvalue expression:
my $variable = /condition/ ? 'TRUE' : 'FALSE';
or as an lvaue expression:
( /condition/ ? $true : $false ) = 'something';
but very rarely, if ever, used in a void context.
The /no_proc/ is a match statement on $_ which yields a true/false value.
The /no_proc/ is a match operator on $_ which yields a true/false value.
print will return a "true value".
It will if it worked correctly, otherwise it will return a "false value".
What would "print /adsf/;" mean? I think nothing,
"print /adsf/;" would print whatever /adsf/ returned, usually either 1 or '' for "true" or "false". But that is not what the expression I wrote would do which would print either "$_\n" or "$_ : in proc\n" depending on whether /no_proc/ was "true" or "false".
In reply to Re^4: if modifier of a print statement
by jwkrahn
in thread if modifier of a print statement
by si_lence
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |