On Thu, Jun 7, 2012 at 3:48 PM, Chris Stinemetz <chrisstinem...@gmail.com>wrote:

> sub getMarketCells {
>  my $val = shift;
>  foreach my $k ( keys %apcHash ) {
>    my($start, $end) = @{$apcHash{$k}}{qw/start end/};
>    return($start, $end) if $val eq $k;
>  }
>  return "";
> }
>

Completely unrelated to your question... It's also possible to replace the
"foreach" loop with the the "exists"
statement<http://perldoc.perl.org/functions/exists.html>.
Something like this:

sub getMarketCells {
    my $val = shift;
    if (exists $apcHash{$val}) {
        return @{$apcHash{$val}}{qw/start end/};
    } else {
        return ();
    }
}

-- 
Robert Wohlfarth

Reply via email to