Skip to content

Instantly share code, notes, and snippets.

@bkamapantula
Created October 25, 2011 01:34
Show Gist options
  • Save bkamapantula/1311048 to your computer and use it in GitHub Desktop.
Save bkamapantula/1311048 to your computer and use it in GitHub Desktop.
Reading files with two columns in Perl - Day 4
#Accepts text file with two columns and prints each column
open(input_file, "2columns.txt");
while(<input_file>)
{
# You will need it if there is whitespace at the end of line
#chomp;
#Splits the line by White-Space
($col1, $col2) = split(' ');
print "Column 1 = $col1\t Column 2 = $col2\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment