title: How can I use Perl extract a particular column from a tab-separated file?
body: <p>I am really new at Perl and have been trying to piece together a solution for this.  When I run this program I don't get any errors and it doesn't display anything.  </p>
  
  <p>The code is as follows:</p>
  
  <pre><code>#!/usr/bin/perl
  open (DATA, "&lt;test1.txt") or die ("Unable to open file");
  use strict; use warnings;
  my $search_string = "Ball";
  while ( my $row = &lt;DATA&gt; ) {
  
      last unless $row =~ /\S/;
      chomp $row;
      my @cells = split /\t/, $row;
  
      if ($cells[0] =~/$search_string/){
          print $cells[0];
      }
  }
  </code></pre>
  
  <p>my test data file looks like this</p>
  
  <pre><code>Camera Make     Camera Model    Text    Ball    Swing
  a       b       c       d       e
  f       g       h       i       j
  k       l       m       n       o
  </code></pre>
  
  <p>I am trying to see how this works before i use the actual test data file.. </p>
  
  <p>So how do I search for say "Ball" and have it return "d i n"</p>