[Melbourne-pm] operator coercion [was: just my opinion]

Mathew Robertson mathew.robertson at netratings.com.au
Wed Sep 17 21:28:24 PDT 2008


> my $c;
> if($c > 5) {    # this coerces $c into 0 for the comparison (with warning)
> }
>
> if($c lt 'a') {  # this coerces $c into '' for the comparison (with warning)
> }
>
> if($c) {         # $c is false, so this expression is false
> }
>   
Doesn't $c get coerced into a boolean (without warning), which is then 
evaluated as false?

ie: for reference, Contextual::Return specifically has a BOOL coercion 
operator.


mathew


More information about the Melbourne-pm mailing list