#delete perl command #@ _COMMENT_ #by ltimas.com on August, 2020 #Reads in a tab delimited file and outputs a comma delimited php array. # Ver3: Add user inputs #@ _COMMENT_ #@ _USE_ use strict; use warnings; use autodie; # die if io problem with file #@ _USE_ #@ _VARDECL_ my $dir = "/put/working/directory"; my $case="O-Ring_data"; my @resltRay; # array variable for later my @resltLns; my $workingdir = $dir ; my $numLoops = 370; my $line = ""; my $line2 = ""; my $index = 0; my $index2 = 1; my $rowTrckr = 0; #@ _VARDECL_ #******* Note this section reads in the data file and creates a data output file open my $infh, '<', $workingdir . '/' . $case ; open my $outfh, '>', $workingdir . '/O-ring_php.txt'; @resltRay = <$infh>; #reads all data lines into result array for (1..$numLoops) { #print $resltRay[$index]; #Use for debugging @resltLns = split('\t',$resltRay[$index]); chomp $resltLns[4]; print {$outfh} ' array(\'' . $resltLns[0] . '\', \'' . $resltLns[1] . '\', \'' . $resltLns[2] . '\', \'' . $resltLns[3] . '\', \'' . $resltLns[4] . '\'),'; print {$outfh} "\n"; $index = $index + 1; }