Created
October 25, 2011 01:34
-
-
Save bkamapantula/1311048 to your computer and use it in GitHub Desktop.
Reading files with two columns in Perl - Day 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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