for my $mode (@probe_modes) { my (@source,@destination); create_map_file $mode; get_elements; # @source and @destination are filled here scan_matrix $mode; undef(@source); undef(@destination); }