Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

nested subroutines

8 views
Skip to first unread message

Chris Stinemetz

unread,
Mar 2, 2013, 5:19:51 PM3/2/13
to Perl Beginners
Thanks in advance.

I have a subroutine inside another subroutine in a module I am tyring to
put together.

I would like to pass the value assigned to $srt in the while loop as the
parameter for the session_attempts subroutine called withing the
processPegs subroutine.

The error I am getting is:

Use of uninitialized value $_srt in numeric ne (!=) at ...

For example:

main program:

while(<>)
{
chomp($_);
next if $_ =~ /PACE/;
my @tokens = split(";",$_);

$srt = $tokens[$fieldMap{"SRT"}];
processPegs($c_s,\%evdo);
}

module:

sub processPegs {
my($_cs, $_t) = @_;

$_t->{$_cs}{$pegs[0]} += session_attempts($srt);
}

Chris

John W. Krahn

unread,
Mar 2, 2013, 8:49:30 PM3/2/13
to Perl Beginners
Chris Stinemetz wrote:
> Thanks in advance.
>
> I have a subroutine inside another subroutine in a module I am tyring to
> put together.
>
> I would like to pass the value assigned to $srt in the while loop as the
> parameter for the session_attempts subroutine called withing the
> processPegs subroutine.
>
> The error I am getting is:
>
> Use of uninitialized value $_srt in numeric ne (!=) at ...

The code provided does not use the ne operator nor does it use the
variable $_srt



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein

Chris Stinemetz

unread,
Mar 2, 2013, 9:22:15 PM3/2/13
to John W. Krahn, Perl Beginners


Sent from my iPhone
> --
> To unsubscribe, e-mail: beginners-...@perl.org
> For additional commands, e-mail: beginne...@perl.org
> http://learn.perl.org/
>
>

Correct. I was able to figure it out.

Thanks,

Chris
0 new messages