print $csv "$lpname\n";
print $csv '*' x length($lpname),"\n";
print $csv "$i,\n";
print $csv "\n\nHost,Entitled CPU and RAM as of @asof,\n\n";
$csv is not a valid FILEHANDLE. It has not been opened anywhere so it cannot be printed to.
open (my $i, "+<", $name) or warn $!; ### FAILS HERE ###
while (<$i>) {
chomp $i;
next if $i =~ /$regexp_2_skip/;
next if $i !~ /$regexp_2_get/;
($i) =~ s/:/,/g;
($i) =~ s/\s+//g;
print $csv "$i,\n";
print "$i,\n";
}
The variable $i is first used as a FILEHANDLE and then used as text from a file.
But in the line while (<$i>) { you are assigning the file text to the variable $_ which you don't use at all.