On 17-04-2023 18:01, David Santiago wrote:
sub MAIN(){ say %?RESOURCES{"text.txt"}.slurp(:close); }
If you really want to use it from a MAIN you could make a lookup method in a module which can do the work for you (If you are building modules anyway).
use AModule; sub MAIN(){ say AModule.new.lookup{"text.txt"}.slurp(:close); } #--- unit class AModule; method lookup ( $needle --> Str ) { %?RESOURCES{$needle} }I think you also do not need a '.new' here and also may define an exported sub
Marcel