in reply to Re: Elegant way of destroying a list
in thread Elegant way of destroying a list
while (<infp>) { if (/^%!PS-Adobe/) #Start of Page Marker { if ($found_match) { @linelist = reverse @linelist; while ($line = pop(@linelist)) { print $line; } $found_match = 0; } else { #Empty List undef @linelist; } } elsif(/^%%Title/) { for $z(@figlist) { if (/$z[A-Za-z]*\.eps/i) { $found_match = 1; } } } push @linelist, $_; }
Basically it parse a PostScript file, ripping out only the pages that match a certain search criteria (@figlist)
I guess a different design would have prevented the need to delete the list. I never really used the "strict" keyword, but I'm glad you brought it up, it does help enforce good coding.
Thanks for your response!
|
|---|