#!/usr/bin/perl -w use strict; use CGI qw(-oldstyle_urls :standard); use Data::Dumper; use Date::Format; use Date::Parse; my $q = new CGI; $| = 1; my @data; my $today = get_timezone(); #set $Data::Dumper::Purity to 1 if you have nested references #$Data::Dumper::Purity = 1; open (FILE, ">data.txt") or die "can't open file: $!"; my $weather_data = do "data.txt"; for my $w_data (@$weather_data) { push @data, \$w_data; } push @data, {$data[0]{'xml_api_reply'}{'weather'}{'report_date'}->{'-data'} = $today,}; print FILE Dumper(\@data); close FILE or die "can't close file: $!"; sub get_timezone { ### Get our local time. $ENV{'TZ'} = 'America/New_York'; $today = time2str( "%m-%d-%Y \@ %H:%M:%S", time); }