sub printfToFile { my $file = shift; my $format = shift; my $arrayCount = @_; my $formatString; for (my $r = 1;$r <= $arrayCount; $r++) { $formatString = $formatString.'$format '; } $formatString = trim( $formatString ); $formatString = $formatString.'\n'; open IO, ">>$file" or die "Cannot open $file for output: $!\n+"; # printf IO "$format $format\n", @_; printf IO "$formatString", @_; close IO; } #### printfToFile( $logfile, '%-22s', $ifName, $ifLease );