Uma máquina de estados não resolveria?
On Sun, Mar 13, 2011 at 5:59 AM, Daniel de Oliveira Mantovani <[email protected]> wrote: > On 13 March 2011 05:37, Nelson Ferraz <[email protected]> wrote: >> Solução rápida (e não testada): >> >> my (@buffer,$current_status); >> while (my $line = <>) { >> push $line, $buffer; > > Acredito que você quis dizer, > push @buffer,$line; > > :) > >> >> if ($line =~ /Status:\s*(\w+)/) { >> $current_status = $1; >> } >> >> if ($line =~ /End/) { >> if ($current_status eq 'ERROR') { >> print join("\n", @buffer); >> } >> >> @buffer = (); >> } >> } >> =begin disclaimer >> Sao Paulo Perl Mongers: http://sao-paulo.pm.org/ >> SaoPaulo-pm mailing list: [email protected] >> L<http://mail.pm.org/mailman/listinfo/saopaulo-pm> >> =end disclaimer >> > > > > -- > "If you’ve never written anything thoughtful, then you’ve never had > any difficult, important, or interesting thoughts. That’s the secret: > people who don’t write, are people who don’t think." > =begin disclaimer > Sao Paulo Perl Mongers: http://sao-paulo.pm.org/ > SaoPaulo-pm mailing list: [email protected] > L<http://mail.pm.org/mailman/listinfo/saopaulo-pm> > =end disclaimer > =begin disclaimer Sao Paulo Perl Mongers: http://sao-paulo.pm.org/ SaoPaulo-pm mailing list: [email protected] L<http://mail.pm.org/mailman/listinfo/saopaulo-pm> =end disclaimer
