## OPEN input file for reading open (IN, "1998_wind_date_time.txt") or die "Couldn't open 1998_wind_date_time.txt "; ## OPEN input file for reading open (OUT, ">1998_wind_formatted_data2.out") or die "Couldn't open 1998_wind_formatted_data2.out"; #!/usr/bin/perl use strict; use warnings; use Time::Local; use POSIX 'strftime'; my $str = '19980730010031'; my $epoch = get_epoch( $str ); print strftime("%m/%d/%Y", localtime($epoch)); sub get_epoch { my $str = shift; my ($yr, $mon, $day, $hr, $min, $sec) = unpack('A4A2A2A2A2A2', $st +r); $mon--; return timelocal($sec, $min, $hr, $day, $mon, $yr); }