In my view of things, this is how it is. :-) If you do "which -a set", you will not get any program named set, that is because it is a built-in bash shell command. So.... use the -c option of bash (read man bash)
#!/usr/bin/perl
use warnings;
use strict;
my @output = `bash -c set`;
print @output,"\n";