CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced: Re: [Stormdev] Why does my array appear to be out of scope?: Edit Log



FishMonger
Veteran / Moderator

May 8, 2009, 2:57 PM


Views: 2094
Re: [Stormdev] Why does my array appear to be out of scope?

I'm unable to duplicate your problem, but I see another issue. Do you see it?


Code
[root@fc4dev ~]# cat stormdev.pl 
#!/usr/bin/perl

use strict;
use warnings;

my @TimeZoneRegions = (
"Eastern Time Zone",
"Central Time Zone",
"Mountain Time Zone",
"Pacific Time Zone",
"Alaska Time Zone",
"Hawaii Time Zone",
);

my $HTML = htmlTimeZonePopdown();

print $HTML;

sub htmlTimeZonePopdown {
my $default = shift;
my $html = "";

$default = 0 if ($default eq "");

foreach my $offset (0..scalar(@TimeZoneRegions)-1) {

my $selected = ($offset == $default) ? "selected" : "";

$html .= qq~ <option value="$offset" $selected>$TimeZoneRegions[$offset]</option>\n ~;
}

return $html;
}


Quote
[root@fc4dev ~]# ./stormdev.pl
Use of uninitialized value in string eq at ./stormdev.pl line 23.
<option value="0" selected>Eastern Time Zone</option>
<option value="1" >Central Time Zone</option>
<option value="2" >Mountain Time Zone</option>
<option value="3" >Pacific Time Zone</option>
<option value="4" >Alaska Time Zone</option>
<option value="5" >Hawaii Time Zone</option>


[edit adjusted a little error on my part]


(This post was edited by FishMonger on May 8, 2009, 3:02 PM)


Edit Log:
Post edited by FishMonger (Veteran) on May 8, 2009, 3:01 PM
Post edited by FishMonger (Veteran) on May 8, 2009, 3:02 PM
Post edited by FishMonger (Veteran) on May 8, 2009, 3:02 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives