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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|