Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by coolda (Novice)
on Sep 29, 2014 at 01:10 UTC ( #1102307=note: print w/replies, xml ) Need Help??


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,

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1102307]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2021-04-16 20:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?