replace @array = split (/\t/, $_); with @array = split;
________________________________ From: Tiago Hori <tiago.h...@gmail.com> To: beginners@perl.org Sent: Monday, April 9, 2012 6:42 AM Subject: Help parsing tab delimited files Hi Guys, I know there are modules for parsing tab delimited files, but I am trying to develop a script as a learning exercise to learn the better, so any help would be appreciated. Let's say I have two columns and two rows: Joe \t Doe Jane \t Doe So here is what I got: #!usr/bin/perl use strict; my $name; my $lastname; my@array; open(FILE, "<", "columns.txt"); while (<FILE>) { @array = split (/\t/, $_); print "$array[0]\n"; print "$array[1]\n"; } close(FILE); So right now this prints Joe and Jane. It seems the split is putting a column in the array. Is there any way that I could parse a row at a time, with each element becoming a entry in the array? My goal is to be able to go through each row at a time and find a specific value. Thanks, Tiago --------------------------- "Education is not to be used to promote obscurantism." - Theodonius Dobzhansky. "Gracias a la vida que me ha dado tanto Me ha dado el sonido y el abecedario Con él, las palabras que pienso y declaro Madre, amigo, hermano Y luz alumbrando la ruta del alma del que estoy amando Gracias a la vida que me ha dado tanto Me ha dado la marcha de mis pies cansados Con ellos anduve ciudades y charcos Playas y desiertos, montañas y llanos Y la casa tuya, tu calle y tu patio" Vioeta Parra - Gracias a la Vida Tiago S. F. Hori PhD Candidate - Ocean Science Center-Memorial University of Newfoundland tiago.h...@gmail.com