Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Split output by tabs

by perlnoobster (Sexton)
on Nov 13, 2012 at 09:35 UTC ( [id://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?

Replies are listed 'Best First'.
Re^3: Split output by tabs
by shmem (Chancellor) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1003574]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 23:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found