I am trying to open a file and then access each line and then enter that line into the "n"th position of an array. I am not sure how to do this. I am pretty new to perl, and would love some help. Here is my small code snippet. What could I do so I can take the undefined length of the value in each line and put it into the array. The byte size of the line in the INPUTFILE is going to constantly change, so I am not sure how to do this. I am perhaps not understanding the concept of @ARGV as I have used it incorrectly here. I know the array is going through to the correct number of lines, but the assignment of the value in that line is not occuring.
Code:
#!/bin/ksh/perl -w
use strict;
##Open file for reading counter##
my $vals = '/u01/home/test_csv.csv';
open (INPUTFILE, $vals)
or die "Could not open the $vals file $!\n";
my $i=0;
my @Total_file;
while (<INPUTFILE>){
$Total_file[$i]=@ARGV;
print "$i value is : $Total_file[$i]\n";
$i++;
}
Code:
#!/bin/ksh/perl -w
use strict;
##Open file for reading counter##
my $vals = '/u01/home/test_csv.csv';
open (INPUTFILE, $vals)
or die "Could not open the $vals file $!\n";
my $i=0;
my @Total_file;
while (<INPUTFILE>){
$Total_file[$i]=@ARGV;
print "$i value is : $Total_file[$i]\n";
$i++;
}