Hi Chris,

On Tue, 29 Nov 2011 07:49:37 -0600
Chris Stinemetz <chrisstinem...@gmail.com> wrote:

>  How can I check that the value assigned to $cell and $sector is numeric
> before I try to call the sprintf function?
> 
> I am just trying to clear this warning.
> 
> Argument "" isn't numeric in sprintf at ./rt_evdo_pcmd.pl line 139, <$FIN>
> line 119503.
> 

well, the best way would be for you to find out why you're inputting an empty
string as a "%d" argument to sprintf, and avoid that. If you want this "" to be
treated as zero, you can do:

my $c_s = sprintf("%d_%d", ($cell || 0), $sector);

Assuming $cell is the offensive one. (or the same for $sector).

Regards,

        Shlomi Fish

> line 139 is from my program is below:
> 
> my $c_s = sprintf("%d_%d",$cell,$sector);
> 
> Thank you in advance.
> 
> Chris



-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
List of Portability Libraries - http://shlom.in/port-libs

Jack: Hi Sophie!
Sophie: Don’t “Hi, Sophie!” me.
Jack: Don’t “Don’t ‘Hi, Sophie!’ me” me!

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to