Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Split output by tabs

by perlnoobster (Sexton)
on Nov 13, 2012 at 09:35 UTC ( #1003574=note: print w/ replies, xml ) Need Help??


in reply to Re: Split output by tabs
in thread Split output by tabs

wow, it works great! thank you :)Just one more question, is there a way of specifying certain columns to be printed? e.g the 10th,18th and 20th column?


Comment on Re^2: Split output by tabs
Re^3: Split output by tabs
by shmem (Canon) on Nov 13, 2012 at 09:41 UTC
    is there a way of specifying certain columns to be printed? e.g the 10th,18th and 20th column?

    One way to do it - use an array slice:

    { local $" = "\t"; print $OUT map "@{$_}[10,18,20]\n", sort { $a->[10] cmp $b->[10] } @ +out; }

    See References quick reference.

      wow that is perfect, where can i read up on in regards to skipping blank/empty values when splitting arrays? :)
        where can i read up on in regards to skipping blank/empty values when splitting arrays?

        Something is wrong wrt your question, since you don't split arrays, you slice or join them. Do you mean omitting empty fields splitting a record, or omitting empty/undefined array elements joining an array?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2015-07-03 03:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (47 votes), past polls