OneCompiler

Perl -get_info

124

#!/usr/bin/perl

use strict;
use warnings;

my %data;

while (<STDIN>) {
chomp;
if (/^sce\s+(.)/) {
my @sce = split(/\s+/, 1);formy1); for my s (@sce) {
data{s}{total} = [];
data{s}{r2r} = [];
}
}
elsif (/^total\s+(.
)/) {
my @total = split(/\s+/, 1);my1); my i = 0;
for my s (keys %data) { push @{data{s}{total}}, total[i],i], total[i+1],i+1], total[i+2];i+2]; i += 3;
}
}
elsif (/^r2r (a* & *b) total\s+(.*)/) {
my @r2r = split(/\s+/, 1);my1); my i = 0;
for my s (keys %data) { push @{data{s}{r2r}}, r2r[i],i], r2r[i+1],i+1], r2r[i+2];i+2]; i += 3;
}
}
}

Print out the data

for my s(keysif(s (keys %data) { if (s =~ /.S./){
print "sce s\n"; print join("\n", @{data{s}{total}}) . "\n"; print join("\n", @{data{s}{r2r}}) . "\n\n"; } elsif (s =~ /.S./){
print "sce s\n"; print join("\n", @{data{$s}{total}}) . "\n";
}
}

close (STDIN);