dwatson06 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to search data from a file for a numeric value. If there is not one, default to four zeros.
I am trying this...
if(substr($AResp, 8, 4) =~ eq /\d\d\d\d/) {
my $shopID = substr($AResp, 8, 4);
}else{
my $shopID = "0000";
}
What am I doing wrong?
Thanks,
Daniel
I am trying this...
if(substr($AResp, 8, 4) =~ eq /\d\d\d\d/) {
my $shopID = substr($AResp, 8, 4);
}else{
my $shopID = "0000";
}
What am I doing wrong?
Thanks,
Daniel
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: checking substring for numbers
by bedk (Pilgrim) on Aug 01, 2002 at 20:10 UTC | |
Re: checking substring for numbers
by BrowserUk (Patriarch) on Aug 01, 2002 at 22:11 UTC | |
Re: checking substring for numbers
by BorgCopyeditor (Friar) on Aug 01, 2002 at 20:11 UTC | |
Re: checking substring for numbers
by dwatson06 (Friar) on Aug 01, 2002 at 20:06 UTC |
Back to
Seekers of Perl Wisdom