Doing it this way would save you and your cpu some effort:
Also, it's usually a very minor point, but if there were a lot more "sdd" things than there are "srs" things, it would be better to have the larger number of things as the inner-most loop (other things being equal...)for my $sdd ( @gSDDdata ) { next unless ( ref( $sdd ) eq 'HASH' and $$sdd{source} ); for my $srs ( @gSRSData ) { next unless ( ref( $srs ) eq 'HASH' and $$srs{sect} ); $$srs{found} = $$sdd{found} = 1 if ( $$sdd{source} =~ /$$srs{sect}/ ); } }
(Update: I thought about using ( ref( $sdd ) eq 'HASH' and defined( $$sdd{source} )) and likewise for srs, but since the crux of the process involves a regex match (which works on strings), I assumed you wouldn't be working on numerics (e.g. "0"), and you wouldn't want to set "found" = 1 in the case where $$srs{sect} was an empty string and $$sdd{source} could be anything at all. But it's up to you to decide how much to trust the data.)
In reply to Re: Use of unintialized value in pattern match (m//) at x.pl line 123
by graff
in thread Use of unintialized value in pattern match (m//) at x.pl line 123
by gibsonca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |