[Bioperl-l] Added check
Elia Stupka
elia@fugu-sg.org
Wed, 12 Jun 2002 15:05:45 +0800 (SGT)
With regards to that problem I was mentioning before to Chris, I have
added a check so we don't try to int a string, but directly conver it to
zero, eliminates all the warnings.
Let me expose my ignorance... I've used this simple regexp, but there must
be a better way to check if a variable is numeric in perl?
[I have asked everybody in the group and checked the web, and everybody
comes up with hacky perl regexps... but perl interprets context as numeric
so there must be a way of evaluating the context on the fly?]
my $intslot=$slot;
$intslot =~ s/E|e|\+|\-//;
if($intslot =~ /^\d+$/) {
$intslot = int($slot);
}
else {
$intslot = 0;
}
--
********************************
* http://www.fugu-sg.org/~elia *
* tel: +65 874 1467 *
* mobile: +65 90307613 *
* fax: +65 777 0402 *
********************************