Nice, but I'd work on the code formatting a bit, it's kinda funky, making it difficult to see what you're trying to do. Also, you don't want to use "my" everywhere, only when you're declaring/defining a variable. Further, if you set a default value to your variable, you only need to set it when it would change.
So the bit you have like this:
if (exists $identifier{$pins1}) { if ( ($w1 == $identifier{$pins1}{'w2'}) && ($h1 <= $identifier{$pi +ns1}{'h2'}) ) { my $start = 1; } else { my $start = 0; } } else { my $start = 0; } printf $output "$wline"; next if (my $start == 0);
could easily be changed to:
my $start = 0; if (exists $identifier{$pins1}) { if ( ($w1 == $identifier{$pins1}{'w2'}) && ($h1 <= $identifier +{$pins1}{'h2'}) ) { $start = 1; } } printf $output "$wline"; next if (my $start == 0);
Then, seeing how it's just a chained if statement, you could further reduce it to:
my $start = 0; if ( exists $identifier{$pins1} && ($w1 == $identifier{$pins1}{'w2'}) && ($h1 <= $identifier{$pins1}{'h2'}) ) { $start = 1; } printf $output "$wline"; next if ($start == 0);
There are other improvements you could make.
I might've answered your question, or I might not have, as I didn't actually see a question.
...roboticus
When your only tool is a hammer, all problems look like your thumb.
In reply to Re: Delete lines if matched expression
by roboticus
in thread Delete lines if matched expression
by DespacitoPerl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |