in reply to Re^2: Separate column results?!
in thread Separate column results?!
update:
I've changed it to the following:
works fine now :) however there is a blank space between the lines the chomp function doesn't seem to work?print "\n$columns[0]\t$columns[1]";
??#!/usr/bin/perl use warnings; use strict; my $PHONE_FILE = 'phones.txt'; open(PHONE_FILE, $PHONE_FILE) or die "Can't open file: $!\n"; my @lines = <PHONE_FILE>; foreach $_ (@lines) { my @columns = split('\t', $_); my $col1 = $columns[0]; my $col2 = $columns[1]; chomp $col1; chomp $col2; print "\n$columns[0]\t$columns[1]"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Separate column results?!
by perlnoobster (Sexton) on Aug 29, 2012 at 09:36 UTC | |
by philiprbrenan (Monk) on Aug 29, 2012 at 10:09 UTC |
In Section
Seekers of Perl Wisdom