If you are going to use Perlbrew in a shell script on macOS, you need to include the following:
#!/bin/bash
source $HOME/perl5/perlbrew/etc/bashrc
perlbrew use perl-5.28.0
For my local test of my yak
Perl application, I use the following script:
#!/bin/bash
source $HOME/perl5/perlbrew/etc/bashrc
perlbrew use perl-5.34.0@app-yak
perl -I $HOME/develop/github-jonasbn/perl-app-yak/lib \
$HOME/develop/github-jonasbn/perl-app-yak/script/yak \ --noconfig \
--nochecksums \
.
source $PERLBREW_HOME/init