perl - Replacing for my $i ( 0, 1, 2 ) with something more stylish? -


i write perl tests in way

 $i ( 0, 1, 2 ) {     is_deeply( $fetch_public_topic_ids->[$i],  $expected_sorted_topic_list->[$i], 'match' ); 

when $expected_sorted_topic array ref test case data. feedback should avoid writing 0, 1, 2, 3... or 0...5 in "for", considered "bad style"?

but alternatives have instead?

you want iterate on indexes of array, no array figures in determining of index. problem hardcoding of indexes.

for $i (0..$#$fetch_public_topic_ids) {    ... } 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -