in reply to Suggestion on rewriting small code

There is no need for flags and counters. It's just making it too complicated. Here is a simple way to do it. First initialize the string to a quote, because you want to start with a quote. then foreach number, add on a job string with the pipes after. once yore done, chop off the last three characters because you don't want two pipes and a space on the end. and put everything in a subroutine so that you aren't just using global variables all over the place.
#!/usr/bin/env perl use strict; use warnings; use feature 'say'; run(); sub run { my @arr = (12341,1245125,1525125,125125125); my $str = '"'; foreach my $num (@arr) { $str .= "job==$num || "; } chop $str; chop $str; chop $str; $str .= '"'; say $str; return $str; }