http://www.perlmonks.org?node_id=1102307


in reply to Re: Is there any efficient way i can take out a specific column from hundreds of files and put it in one file?
in thread Is there any efficient way i can take out a specific column from hundreds of files and put it in one file?

this is great, may i ask what @ARGV and <> do in the second code? I googled it and i learned that empty diamond reads the @ARGV. So if you just set @ARGV = <*.txt> it reads any .txt file saved in that directory in order? If i want to skip the first line for every file, what should i do? I tried many things but it won't work. I usually used <$fh>; to read the first line and tried, next if $. <2 but neither worked.. Is there anyway you can skip the header(the first line) when using while(<>){} ???
  • Comment on Re^2: Is there any efficient way i can take out a specific column from hundreds of files and put it in one file?

Replies are listed 'Best First'.
Re^3: Is there any efficient way i can take out a specific column from hundreds of files and put it in one file?
by Lotus1 (Vicar) on Sep 29, 2014 at 03:47 UTC

    The Anonymous Monk deleted the header row in the code provided above.

    delete $row{Gene};

    That seems like the easiest way to do it. To do what you are asking here you can use eof. Also refer to Variables related to filehandles

      oh yes i noticed that, however my actual files has one more line above the row deleted by
      delete $row{Gene};
      So i need to skip the first row and then delete the Gene row.. thanks for the input, i'll look into the links
      i used next if /^/ ; it works well!! thanks,