Christopher Spears <[EMAIL PROTECTED]> wrote:
: Here is the latest version of my script:
I think you are using the wrong approach to parsing
this output. You're making it a lot more complicated
than it needs to be. I omitted the report and question
sections. Your report data is in %licenses.
Read 'perldsc' for info on printing from a hash of
arrays (HoA).
I use a sub routine to fetch the licenses. In that
sub I remove all lines except the ones starting with a
" and those containing a handle.
use strict;
use warnings;
use Data::Dumper 'Dumper';
my $name;
my %licenses;
foreach ( fetch_licenses() ) {
if ( /"([^"]+)/ ) {
$name = $1;
} elsif ( m|lex/\d+ (\d+)| ) {
push @{ $licenses{ $name } }, $1;
}
}
print Dumper \%licenses;
sub fetch_licenses {
my @raw_licenses = `cat clicenses_output`;
# keep only license names and handles
return grep { m/^\s+"/ or m|\(lex/\d+ \d+\)| } @raw_licenses;
}
__END__
Sometimes it necessary to scrap what you are doing
and just start again.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>