SH script calls Perl script. Works when I double click, but Perl script fails when I call from terminal Severe newb here.  I have a shell script that simply calls a perl script to create a file.  It works if I double-click the SH file, but fails if I call the file in a terminal. here is the entire SH file:

#! /bin/bash
# Run Will's JSON Script


perl /Users/j.douet/Documents/JSON/pbmJson.pl -i /Jaspersoft/tmp/output/hospicemed/hhcsys/hhcsys_hospicemed_201711251121140465.txt -m newPatient -n 1234 &gt; /Jaspersoft/tmp/output/hospicemed/hhcsys/hhcsys_hospicemed_201711251121140465.json;


It really is that simple. No arguments yet as I am testing. When I double-click, my output file is created, but when I execute

sh runhmJSON.sh


I get errors within the perl script, all similar to:

/Users/j.douet/Documents/JSON/pbmJson.pl: line 3: use: command not found


Thoughts?
That error indicates your pbmJson.pl is being run by a shell, and not by perl:

$ cat someperlcode
printf "hi\n";
printf "there\n";
use strict;
$ perl someperlcode
hi
there
$ sh someperlcode
hi
there
someperlcode: use: not found
$ use
mksh: use: not found
$ bash
bash-3.2$ use
bash: use: command not found
bash-3.2$ exit
exit
$ 


As written, I see no error in what you've posted:

$ cat code
#! /bin/bash

perl someperlcode &gt; output
$ chmod +x code
$ rm output
$ ./code
$ cat output
hi
there
$ rm output
$ sh code
$ cat output
hi
there
$