in reply to [SOLVED] How do I determine with a regular expression whether a scalar is a number/whole/integer/float?

The output you've posted did not come from the code that you posted.

Running the code you posted, (second code block) under 5.10 and 5.18 I get this output:

The 1 is a whole number The 1 is a whole number The 123.1 has nondigits The 0.1 has nondigits

I suspect the code you actually ran to get the output you posted included:

my @numbers = qw(1, 1.0, 123.1, 0.1);

And did not have warnings enabled.

But that doesn't explain all the differences.

Try posting the actual code you run; and the actual output you get.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!
  • Comment on Re: How do I determine with a regular expression whether a scalar is a number/whole/integer/float?
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: How do I determine with a regular expression whether a scalar is a number/whole/integer/float?
by thanos1983 (Parson) on Jul 12, 2015 at 00:08 UTC

    Hello BrowserUk,

    You are right, I modified the question while you where trying to answer it. I am sorry for that. I noticed that I was testing two number 1 and 1.0 which will give the exact output.

    That is why I modified the code again. I have updated the testing code and also the output.

    Thank you for your time and effort reading and assisting me with my question.

    Seeking for Perl wisdom...on the process of learning...not there...yet!