I am aware of the differences between -w and use warnings. I chose to use -w and $^W=0 within the localised scope of a subroutine who's sole purpose was to avoid them, which is I think, a legimite tactic given this was golf and only keystrokes count.
The reasons why my (fully tested*) code both produced warnings and apparently failed to produce the desired output, was because you ran it in a context different from that in which it was designed to run and made no attempt to correct for that change of context in any meaningful way.
In fact you deliberately suppressed the (correct) output for reasons I can only speculate on.
vis.
#! perl -w use warnings; use strict; my $foo = { aa => { O => 'zz', C => 'yy' }, # bb => { O => 'xx', C => 'xx' }, cc => { O => undef, C => 'ww' }, # dd => { O => 'vv', C => undef }, # ee => { O => undef, C => undef }, ff => { C => undef }, gg => { O => 0, C => 0 }, hh => { O => undef, C => 0 }, # }; #234567890123456789012345678901234567890123456789012345678901234567890 +1234567890123 sub f{no warnings;$a=pop;grep{!exists$a->{$_}{O}or$a->{$_}{O}ne$a->{$_ +}{C}}keys%$a} # 83! print "@{[f($foo)]}\n"; __DATA__ C:\test>201598 dd ff aa hh cc C:\test>
Even in this form, it still complies with the original spec and comes in at 83
*My original post contained both fully working program and its output unedited. No warnings, and the required output.
In reply to Re: Re: Re: Re: Re: (Golf) Warningless Comparison
by BrowserUk
Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!
in thread (Golf) Warningless Comparison
by tadman
For:
Use:
& & < < > > [ [ ] ]