Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: How to iterate thru entire array with start point other than beginning

by dirtdog (Monk)
on Sep 01, 2016 at 19:36 UTC ( [id://1171014]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1171014]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found