Thank you all for your help, I got the desired result and didn't have to change the contents of the file, here is the code for reference
use Path::Class;
use Data::Dumper;
#Input was inserted into a file...
my $dir = dir("C:\\temp\\");
my $file = $dir->file("hashinput.txt");
my $file_handle = $file->openr();
my %slotHash = ();
while (my $line = $file_handle->getline()){
if (index($line, "Press", 0) == -1 && index($line, "Slot", 0)
+== -1)
{
$value0 = substr($line, 0, 2);
$value1 = substr($line, 3, 17);
$value2 = substr($line, 20, 15);
$value3 = substr($line, 36, 17);
$value4 = substr($line, 55, 17);
$uptime = $value4;
my $find = " days ";
my $replace = ":";
$find = quotemeta $find; # escape regex metachars if prese
+nt
$uptime =~ s/$find/$replace/g;
$delimiter = quotemeta(":");
my @uptime = split(/$delimiter/, $uptime);
$totalUptime = (((@uptime[0] * 24) * 60) * 60) + ((@uptime
+[1] * 60) * 60) + (@uptime[2] * 60) + @uptime[3];
$slothash{$value0} = (
{type => substr($value1,0, 3) ,slotID => $value0, des
+cription => $value1,hwVersion => $value2, swVersion => $value3 ,slotI
+d => $value0, upTime => $totalUptime}
);
}
}
print Dumper(\%slothash);
THANKS!