in reply to Find If Value Exists In Array Of Hashes

        Profanity is the one language all programmers know best.

  • Comment on Re: Find If Value Exists In Array Of Hashes

Replies are listed 'Best First'.
Re^2: Find If Value Exists In Array Of Hashes
by ImJustAFriend (Scribe) on Aug 10, 2014 at 07:16 UTC

    Thanks NetWallah for the questions. While getting sample data to answer them, I noticed there is a way to de-dup built right into the data stream lines (field 4, the "Y" in my sample, has to be "Y" -> if it's "N", it's a duplicate). If you wouldn't have asked for clarification, I never would have seen that!!

    Thank you so much for leading me to a FAR simpler solution than I imagined!!!

      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
        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