foreach ($self->{'sections'}) { ..use $_ here to do stuff.. } #### print ref($_); #### my $val = $_; use Carp qw(confess); if ( ! defined $val ) { return 'null'; } elsif ( ! ref($val) ) { if ( $val =~ /^-?\d+$/ ) { return 'int'; } elsif ( $val =~ /^-?\d+(\.\d+)?$/ ) { return 'float'; } else { return 'string'; } } else { my $type = ref($val); if ( $type eq 'HASH' || $type eq 'ARRAY' ) { return 'array'; } elsif ( $type eq 'CODE' || $type eq 'REF' || $type eq 'GLOB' || $type eq 'LVALUE' ) { return $type; } else { # Object... return 'obj'; } } #### my $sections = (qx!rabin -Svv $filename!); my @detected_sections = (); while ($sections =~ m/idx\=(\d*) address=(0x(\d|[a-f])*) offset=(0x(\d|[a-f])*) size=(\d*) align=(0x(\d|[a-f])*) perm=((r|w|x|-){4}) name=(.*)/gi) { my %section_int = ( index => $1, address => $2, offset => $4, size => $6, align => $7, rights => $9, name => $11 ); push (@detected_sections, %section_int); } $report->{'sections'} = @detected_sections;