Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: Separate column results?!

by perlnoobster (Sexton)
on Aug 29, 2012 at 09:36 UTC ( #990418=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Separate column results?!
in thread Separate column results?!

i got it to work :)

foreach $_ (@lines) { my @columns = split('\t', $_); chomp @columns; my $col1 = $columns[0]; my $col2 = $columns[1]; chomp $col1; chomp $col2; print "\n$columns[0]\t$columns[1]"; }


Comment on Re^4: Separate column results?!
Download Code
Replies are listed 'Best First'.
Re^5: Separate column results?!
by philiprbrenan (Monk) on Aug 29, 2012 at 10:09 UTC

    Or perhaps:

    use feature ":5.14"; use warnings FATAL => qw(all); use strict; my @lines = split /\n/, << 'END'; 111 aaa bbb 222 ccc ddd 333 eee fff END say join "\t", @{[split]}[0,1] for @lines;

    Produces:

    111	aaa
    222	ccc
    333	eee
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2015-07-08 07:47 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 (96 votes), past polls