Here is a bit of a hack that should work to do what you want without asking your students to clear the cache.
On the line before you start the for loop to generate the images add
$timestamp = time;
Then change the last line in the for loop from
$fig[$j] = image(insertGraph($graph[$j]),width => 240,height => 180,tex_size => 200);
to
$fig[$j] = image(insertGraph($graph[$j]),width => 240,height => 180,tex_size => 200) =~ s/~~.png"/.png?timestamp=$timestamp"/gr;
so you end up with:
$timestamp = time;
for my $j (0 .. 5) {
$graph[$j]->lb('reset');
$graph[$j]->lb(new Label(-.07,-1,-1,'black','right','middle'));
$graph[$j]->lb(new Label(-.07,1,1,'black','right','middle'));
for ($i = -3; $i <= 3; $i++) { if ($i != 0) {
$graph[$j]->lb(new Label(0.25*$i,-.2,0.25*$i,'black','center','top')) }};
$graph[$j]->lb(new Label(-.05,1.9,"y",'black','right','top'));
$graph[$j]->lb(new Label(0.95,0.1,"t",'black','right','bottom'));
plot_functions( $graph[$j], $g[$j]);
$fig[$j] = image(insertGraph($graph[$j]),width => 240,height => 180,tex_size => 200) =~ s/~~.png"/.png?timestamp=$timestamp"/gr;
};
The added url parameter "timestamp" makes the url different each time the problem is loaded, and so the browser will not try to load from cache. The server will ignore that parameter and still serve the same file. Of course you have $refreshCachedImages = 1, so that file will be different than before if the "Get new version of this problem" button is clicked.