On 12/7/13 at 17:35, rvtol+use...@isolution.nl (Dr.Ruud) wrote:


perl -0 -wple 's/^start\n(.*?)\nend\n/$_=$1;y{\n}{ };"$_\n"/emgs'

Pure obfuscation! Why not keep things simple?! These stupid one-liners are a pain in the brain.

#!/usr/bin/perl
use strict;
my @items;
while (<>) { # or use a file handle
    chomp;
    next if /^start/;
    if (/^end/) {
        print join ", ", @items;
        print "\n";
        undef @items;
    } else {
        push @items, $_;
    }
}

JD


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to