in reply to Re^2: Find If Value Exists In Array Of Hashes
in thread Find If Value Exists In Array Of Hashes

Instead of all of those if clauses to add leading zeroes to the date / time elements could you not just use sprintf ? (untested)
my $stamp = sprintf '%02d/%02d/%02d.%02d.%02d.%02d', $year, $mon, $mday, $hour, $min, $sec

Replies are listed 'Best First'.
Re^4: Find If Value Exists In Array Of Hashes
by Anonymous Monk on Aug 12, 2014 at 09:23 UTC
Re^4: Find If Value Exists In Array Of Hashes
by SirClive (Scribe) on Aug 12, 2014 at 09:28 UTC
    It's a long time since I wrote any perl :( Correction
    use strict; use warnings; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); my $stamp = sprintf "%02d/%02d/%02d %02d.%02d.%02d", $year +1900, $mon +1 , $mday, $hour, $min, $sec; print STDOUT $stamp;
    Output 2014/08/12 10.24.56
      Ah yes - as I said it is a long time since I used perl and even longer since I used 'C' :) :) This is better
      use strict; use warnings; use POSIX qw(strftime); my $date = strftime("%Y/%m/%d %H:%M:%S\n", localtime(time)); print $date;
      Output 2014/08/12 10:36:29

        Thanks, SirClive!! I never think of things like "strftime" or whatever... appreciate the reminder!! Will look into that tomorrow...