use strict; while (my $something) { my ($a, $b); testFunc($a, $b); } sub testFunc { my ($a, $b) = @_; ... do something ... }