in reply to Efficiency revisited
The inclusion of $junk on the LHS of the split assignment is unnecesary. Take it out, remove the third argument to split on the RHS, and split will automatically split the string into no more than 15 pieces (one more than the number of lvalues on the left) and discard the extra piece.
That condition is backwards; if $op_target is not defined, it will always be equal to ''. To avoid a warning; the defined test should come first.next if $op_target eq '' or ! defined $op_target;
And one efficiency comment...
You may get a small measure of improved efficiency by combining the calls to sprintf with the call to print. For example:
printf "$user_ip_addr $username - " . "[%02d/$months[$date_mon]/$century%02d:%08d $utc_offset] " . qq{"$op_name $op_target" $service_status_code $bytes_sent "-" " +-"\n}, $date_dd, $date_year, $time;
|
|---|