Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: non numeric data

by Happy-the-monk (Monsignor)
on Jun 24, 2013 at 13:37 UTC ( #1040439=note: print w/ replies, xml ) Need Help??


in reply to non numeric data

true only when it has a non numeric data

I'd personally try this first:

if ($array_H[$i] =~ m/\D/ ) { block; }

where \D matches any one character that isn't 0..9.

Now empty strings and all-0-9-stuff pass, everything else enters the block.

Cheers, Sören

(hooked on the Perl Programming language)


Comment on Re: non numeric data
Download Code
Re^2: non numeric data
by tobyink (Abbot) on Jun 24, 2013 at 14:10 UTC

    /\D/ matches 1.1, -4 and 1000000000000000 (depending on your CPU architecture).

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

      /\D/ matches 1.1, -4 and 1000000000000000 (depending on your CPU architecture).

      Good point, tobyink!

      Cheers, Sören

      (hooked on the Perl Programming language)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040439]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-11-26 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (162 votes), past polls