% # my $tab_id is set higher in the code^^^ % my $foo = $c->req->param('foo'); % my $bar = $c->req->param('bar'); % my $baz = $c->req->param('baz'); % my @update = split(/,/, $c->req->param('biz'); #this is an array of place to delete # the items % if ( ($foo) && ($baz == 2) && (and{$tab_id == $_}@update) ) { % my @delete_items = split (/,/, $foo); % my $del_count = scalar(@delete_items); deletes += <%$del_count%>; # this is setting the JS variable for the counts % } % if ( ($bar) && ($baz == 2) && (and{$tab_id == $_}@update) ) { % my @delete_items = split (/,/, $bar); % my $del_count = scalar(@delete_items); deletes += <%$del_count%>; % } --------------------------------------------------------------------------------- // javascript section: if(deletes > 0) { return confirm('Delete ' . + deletes + . 'Items? '); }