Please help me with this Perl question, thanks You have a CSV file where the fir
ID: 3710873 • Letter: P
Question
Please help me with this Perl question, thanks
You have a CSV file where the first line contains column names. Your Perl script has two parameters – a filename and a string (representing a column name). Print out all values in the file that are in the column whose column name matches the string. For example, if you have a CSV file and the first line is “First Name”, ”Last Name”, ”Age”, ”Hair Colour” then perl colName.pl datafile.csv “Last Name” will print out all of the values in column 2 of the CSV file.
Explanation / Answer
Here you will get all the column names and you can easily compare it with required string and get the required output.
Note: If the first line of CSV file is header and second line is all column fields.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.