thanks much,
jynx
Update:ok, after everyone's replies i finally realized what happened. In a coding frenzy i wanted to solve one problem and when i switched to a different technique i didn't drop some of the old artifacts (oops).
Basically, i'm trying to keep track of whether or not a value is acceptable for grep without having to declare the arrays(this was for an obfuscation-only purpose). The fix was to declare the arrays, because of the reasons mentioned and because otherwise nothing would get passed through grep the first time through...
My main problem is that i check for $new{$_}+1, i should be checking for $new{$_}-1.
If anyone's interested, the resulting (admittedly horrible) code is:
This still declares the arrays, just not the same way. Oh well, nothing's perfect, it has lumps in it ;-)sub beautify { %old = %new; sort { $a <=> $b } grep { $new{$_}++; $old{$_}++ unless exists $old{$_}; ($new{$_} == $old{$_}) ? 1 : ($new{$_}-1 == $old{$_}) ? 1 : 0; } @_; }
As also noted, this is *not* the best way to do this, for normal projects of course one would use strict; and warnings.
Thanks for the help,
jynx
In reply to Re: Re: quandery about a grep statement
by jynx
in thread quandery about a grep statement
by jynx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |