in reply to Re^2: How to iterate thru entire array with start point other than beginning
in thread How to iterate thru entire array with start point other than beginning

I have some code that works, but boy o' boy is it ugly.

#!/usr/bin/perl use POSIX 'strftime'; use strict; my $m; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; my $curr_mth = sprintf "%2d", strftime('%m', $sec,$min,$hour,$mday,$mo +n,$year,$wday,$yday,$isdst); my @month_name = qw(January February March April May June July August +September October November December); for ( $curr_mth .. $#month_name) { print "Month name is: $month_name[$_]\n"; $m++; } if ( $m < 12 ) { for my $n ( 0 .. ($#month_name - $m) ) { print "Month name is: $month_name[$n]\n"; } }
  • Comment on Re^3: How to iterate thru entire array with start point other than beginning
  • Download Code

Replies are listed 'Best First'.
Re^4: How to iterate thru entire array with start point other than beginning
by planetscape (Chancellor) on Sep 02, 2016 at 15:48 UTC
    but boy o' boy is it ugly

    I always say, first make it work. THEN make it pretty. ;-)

    HTH,

    planetscape