This "Useless use" message can be easily made by just having a statement with only a string literal inside. The message reads interestingly and rather high context -- meaning: readers need to learn at least a little bit about the concept of context in Perl programming language, to be able to understand that no words in that message are useless or void.
# perl x.pl
Useless use of a constant ("forty-two") in void context at x.pl line 3.
# cat x.pl
use v5.36;
"forty-two";
EndlessMason
in reply to gugod • • •Kalamata Hari
in reply to EndlessMason • • •@EndlessMason In a module, it's not in void context so you don't get the warning. 😀
Also, most modules use
1
, which is specifically exempt from this warning anyway:EndlessMason
in reply to Kalamata Hari • • •@barubary
Most of mine end with "a true value"
@gugod
Daniel Böhmer
in reply to EndlessMason • • •#perl
EndlessMason
in reply to Daniel Böhmer • • •@dboehmer
If you want to return a value from a script you use 'exit'
@gugod