it's effectively
return scalar(10,20);
so no warning
DB<100> print scalar (10,20) 20
UPDATE: maybe the following is clearer,
DB<113> sub tst { 2..10 } => 0 DB<114> ($a)=tst() => 2 DB<115> $a=tst() => "" DB<116> sub tst { /2/../10/ } => 0 DB<117> $_=2 => 2 DB<118> $a=tst() => 1 DB<119> $a=tst() => 2 DB<120> $_=10 => 10 DB<121> $a=tst() => "3E0"
as you can see the range-op transforms to flip-flop-op in scalar context.
So we are not returning a list but an expression which is evaluated according to the callers context.
Cheers Rolf
In reply to Re^3: no expected 'Useless use of a constant in void context' warning for expression in return statement
by LanX
in thread no expected 'Useless use of a constant in void context' warning for expression in return statement
by ed_hoch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |