GetOptions( 'f' => \my $force, 'o' => \my $outdir, ); $outdir ||= 'thumbnails'; my $needs_remake = My::Dependencies::MTime->new( force => $force ); for my $source_image (@ARGV) { if ($needs_remake->([$source_image], ["$outdir/${source_image}_t.jpg"])) { ... do work here }; };