How to convert a perl script to a shell script?

curious would anyone know how to reproduce this perl script as a shell script. I can not figure out how to replicate the command “open” in shell

open(SUB, "/usr/bin/mosquitto_sub -t grid |");
my $filename = '/tmp/MQTT/grid.TMP' ;
system("touch $filename");
while ($MQTT = <SUB>) {
open(FH, '>>', $filename) or die $!;
print FH $MQTT, " " ;
close(FH);
}

I am trying to make it run via init.d as a service and perl not allowed as a service with out a helper program

what it does is open a topic - monitor it for an output, - once there is an output it writes it to a cache file, TMP – then a CollectD -exec script looks at this TMP file reads the file of the data - averages it based on your CollectD interval and inputs it to a rrd database . which is then can generate a historic values in statistics page easily

example visualization on a openwrt router