in reply to Using printf

Other mighty monks have already said all that there is to say. I'll just add some comments about legibility and nice formatting.

The printf function takes a format as first argument, and then a list of values. The first argument being special, I'm fond of using the => operator to let it stand out from the rest:

printf "%18s %18s %18s\n" => $ip_date_time[$i]{ip}, $ip_date_time[$i]{date}, $ip_date_time[$i]{time};

Now, we use three times the $ip_data_time[$i]: if you translate that into English, it reads: "print out the ip of the ith element of $ip_date_time, the date of the ith element of $ip_date_time and the time of the ith element of $ip_date_time". I guess it would sound more natural to say "print out the ip, date and time of the ith element of $ip_date_time". Several ways to say that in perl:

# a map print "%18s %18s %18s\n" => map {$ip_date_time[$i]{$_}} qw/ip date tim +e/; # a hash slice print "%18s %18s %18s\n" => @{$ip_date_time[$i]}{qw/ip date time/};

Voilà, that was just my €0.02.

--bwana147