http://qs321.pair.com?node_id=11102079


in reply to Refactoring just to refactor?

I hope that i'm not totally Perl-Blind but a good refactoring might be to rewrite your fancy sub like this:

sub index_menu { my $dir = shift; # my @file_list = file_list('.'); my @file_list = file_list($dir); # if this is what you meant my $files = [ map { anchor( textify($_), { href => $_ } ) } grep { /^[A-Z].+/ && -f $_ } sort { article_sort($a, $b) } @file_list ]; return $files; }

You may also consider to use the more hard-boiled style and omit the explicit return but that's a matter of taste.

And if i where in your shoes i would leave my old working code untouched and use the BLOCK LIST style (which is the natural way IMHO) from today on.

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help