Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
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 perusing the Monastery: (4)
As of 2014-09-24 03:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (244 votes), past polls