Non-assembly language programmers would probably do something like,

use List::Util 'max';
my $length = max(@csv_fields, @import_fields);

or

my $length = @csv_fields > @import_fields ? @csv_fields : @import_fields;

-1 if for some reason you particularly need $#foo

Paul

On Mon, Jun 14, 2010 at 15:46, Lyle <[email protected]> wrote:
> Hi All,
>   This technique came up at one of the meets. I just used this piece of
> code in a project:-
> my $length = ($#import_fields, $#csv_fields)[ @csv_fields > @import_fields];
>   Is it advisable though from a maintenance and readability point of view?
>
> Lyle
>
> _______________________________________________
> BristolBathPM mailing list
> [email protected]
> http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm
>

_______________________________________________
BristolBathPM mailing list
[email protected]
http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm

Reply via email to