Note that you did not follow any of the advice I listed above. You did not show a sample of input. You did not show a sample of output. You did not explain why you are using a one-liner. You did not say why the provided code modification didn't do what you needed. Why are you making it hard for me to help you?
I have files like file 1,file 2,file 2 etc like in hundreds...
You can use
opendir and
readdir to cycle over, as I said previously, or use
glob if you are so inclined.
-n uses
<> to read files (see
I/O Operators), so it will implicitly cycle over the argument list - thus
*.gcount will be expanded by the shell into a full file list and get cycled over.
It has data in columns so I would like to extract 0 and 4 column from every file
So why aren't you using
Text::CSV to read it?
i am asking that if theres any posibility to include every thing in single code
A great deal is possible. That doesn't make it a good idea. After all this time and effort, a simple script would have been written and done already. That certainly could be considered a "single code". Why are you hung up on one-liners?
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.