Re: subroutine returning data

2012-06-10 Thread Shlomi Fish
Hi all, On Tue, 05 Jun 2012 10:15:36 -0700 John W. Krahn jwkr...@shaw.ca wrote: [ Please do not top-post your replies. Please remove non-relevant text from your reply before posting. TIA ] don't insult and dismiss out of hand the findings of those who take the time to help you. If I

Re: subroutine returning data

2012-06-05 Thread Shlomi Fish
Hello John, On Mon, 04 Jun 2012 14:19:27 -0700 John W. Krahn jwkr...@shaw.ca wrote: Chris Stinemetz wrote: I have a subroutine that I want to return 1 only if the value of %{$href-{$_[0]}} is equal to 'ND' for the whole 24 occurences. One way to do it: sub site_offAir { return

Re: subroutine returning data

2012-06-05 Thread John W. Krahn
Shlomi Fish wrote: On Mon, 04 Jun 2012 14:19:27 -0700 John W. Krahnjwkr...@shaw.ca wrote: Chris Stinemetz wrote: I have a subroutine that I want to return 1 only if the value of %{$href-{$_[0]}} is equal to 'ND' for the whole 24 occurences. One way to do it: sub site_offAir {

RE: subroutine returning data

2012-06-05 Thread Jack Maney
ProTip: If you're going to ask for help, don't insult and dismiss out of hand the findings of those who take the time to help you. -Original Message- From: John W. Krahn [mailto:jwkr...@shaw.ca] Sent: Tuesday, June 05, 2012 2:18 AM To: Perl Beginners Subject: Re: subroutine returning

List behavior pro tips (was: Re: subroutine returning data)

2012-06-05 Thread John SJ Anderson
for help, don't insult and dismiss out of hand the findings of those who take the time to help you. -Original Message- From: John W. Krahn [mailto:jwkr...@shaw.ca] Sent: Tuesday, June 05, 2012 2:18 AM To: Perl Beginners Subject: Re: subroutine returning data Shlomi Fish wrote

Re: subroutine returning data

2012-06-05 Thread John W. Krahn
[ Please do not top-post your replies. Please remove non-relevant text from your reply before posting. TIA ] Jack Maney wrote: ProTip: The top two results from Google state: PROTIP | Know Your Meme About PROTIP is a term often used in forums and comments to preface snarky, obvious,

subroutine returning data

2012-06-04 Thread Chris Stinemetz
I have a subroutine that I want to return 1 only if the value of %{$href-{$_[0]}} is equal to 'ND' for the whole 24 occurences. Any suggestions is greatly appreciated. Thank you, Chris sub site_offAir { for (values %{$href-{$_[0]}}) { return 1 if $_ eq 'ND'; #need to test all values are

Re: subroutine returning data

2012-06-04 Thread Paul Johnson
On Mon, Jun 04, 2012 at 11:30:30AM -0500, Chris Stinemetz wrote: I have a subroutine that I want to return 1 only if the value of %{$href-{$_[0]}} is equal to 'ND' for the whole 24 occurences. Any suggestions is greatly appreciated. Thank you, Chris sub site_offAir { for (values

Re: subroutine returning data

2012-06-04 Thread Bill Stephenson
On Jun 4, 2012, at 11:30 AM, Chris Stinemetz wrote: I have a subroutine that I want to return 1 only if the value of %{$href-{$_[0]}} is equal to 'ND' for the whole 24 occurences. Any suggestions is greatly appreciated. Chris, I don't know how to read your hash directly (hash of hashes?)

Re: subroutine returning data

2012-06-04 Thread Shawn H Corey
On 12-06-04 12:30 PM, Chris Stinemetz wrote: I have a subroutine that I want to return 1 only if the value of %{$href-{$_[0]}} is equal to 'ND' for the whole 24 occurences. Any suggestions is greatly appreciated. Thank you, Chris sub site_offAir { for (values %{$href-{$_[0]}}) {

Re: subroutine returning data

2012-06-04 Thread Bill Stephenson
Thanks Shawn! The values %{$href-{$_[0]}} code is pretty ugly but I get it now. And it make sense to break out of the loop as soon as you don't pass the test. Kindest Regards, Bill Stephenson On Jun 4, 2012, at 12:49 PM, Shawn H Corey wrote: On 12-06-04 12:30 PM, Chris Stinemetz wrote:

Re: subroutine returning data

2012-06-04 Thread Shawn H Corey
On 12-06-04 02:01 PM, Bill Stephenson wrote: The values %{$href-{$_[0]}} code is pretty ugly but I get it now. And it make sense to break out of the loop as soon as you don't pass the test. sub site_offAir { my $site_id = shift @_; for my $activity_code ( values %{

Re: subroutine returning data

2012-06-04 Thread Chris Stinemetz
Thank you everyone. Your help has been very helpful.. Chris -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: subroutine returning data

2012-06-04 Thread John W. Krahn
Chris Stinemetz wrote: I have a subroutine that I want to return 1 only if the value of %{$href-{$_[0]}} is equal to 'ND' for the whole 24 occurences. One way to do it: sub site_offAir { return values %{ $href-{ $_[ 0 ] } } == grep( $_ eq 'ND', values %{ $href-{ $_[ 0 ] } } ) ? 1 : '';