Re: return two varibles

2012-06-07 Thread Chris Nehren
On Thu, Jun 07, 2012 at 16:59:58 -0400 , Shawn H Corey wrote: > On 12-06-07 04:48 PM, Chris Stinemetz 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;

Re: return two varibles

2012-06-07 Thread Robert Wohlfarth
On Thu, Jun 7, 2012 at 3:48 PM, Chris Stinemetz 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...

Re: return two varibles

2012-06-07 Thread Chris Stinemetz
> You may be returning two values, but you're only catching one. > > Try > > my( $start, $end ) = getMarketCells( $apc ); > > > chrs, > john. You are correct. Thank you very much! Chris -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@per

Re: return two varibles

2012-06-07 Thread Shawn H Corey
On 12-06-07 04:48 PM, Chris Stinemetz 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 ""; return; } A return with any argument will return

Re: return two varibles

2012-06-07 Thread Jim Gibson
On Jun 7, 2012, at 1:48 PM, Chris Stinemetz wrote: > Not sure what I am doing wrong but my subroutine is only returning the > value on varible. I would like it to return both $end and $start for > the correct parameter I am passing. If you want to return two or more values from a subroutine, the

Re: return two varibles

2012-06-07 Thread John SJ Anderson
On Thursday, June 7, 2012 at 4:48 PM, Chris Stinemetz wrote: > my $test = getMarketCells($apc); > You may be returning two values, but you're only catching one. Try my( $start, $end ) = getMarketCells( $apc ); chrs, john. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For addi