greatshots has asked for the wisdom of the Perl Monks concerning the following question:
monks,
How it can be in one-liner ?#!/usr/bin/perl use strict; while ( <DATA> ) { chomp; my $line = $_; my $i = 0; foreach my $val ( split(',',$line) ) { if ( $i == 2 ) { $i = 0; print "$val\n"; next; } print "$val,"; $i ++; } } __DATA__ userid,application_id,time,userid,application_id,time,userid,applicati +on_id,time ,
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How can I make it to a one liner
by moritz (Cardinal) on Oct 08, 2007 at 07:09 UTC | |
by moritz (Cardinal) on Oct 08, 2007 at 07:50 UTC | |
Re: How can I make it to a one liner
by ikegami (Patriarch) on Oct 08, 2007 at 07:19 UTC | |
Re: How can I make it to a one liner
by jeanluca (Deacon) on Oct 08, 2007 at 07:23 UTC | |
Re: How can I make it to a one liner
by jwkrahn (Abbot) on Oct 08, 2007 at 09:52 UTC | |
Re: How can I make it to a one liner
by Somni (Friar) on Oct 08, 2007 at 07:39 UTC | |
Re: How can I make it to a one liner
by Punitha (Priest) on Oct 08, 2007 at 07:15 UTC | |
Re: How can I make it to a one liner
by educated_foo (Vicar) on Oct 08, 2007 at 18:16 UTC |
Back to
Seekers of Perl Wisdom