Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: number array with space

by 2teez (Vicar)
on Jun 20, 2013 at 06:21 UTC ( [id://1039891]=note: print w/replies, xml ) Need Help??


in reply to Re^2: number array with space
in thread number array with space

(works only in a fairly recent version of Perl):
of course yes! in Perl 5.12 or better !!!. Nice one...

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

Replies are listed 'Best First'.
Re^4: number array with space
by MynameisAchint (Novice) on Jun 20, 2013 at 06:51 UTC
    Hey

    one more question that how to check whether the element in an array is a number or not . is there any function in perl

      See Scalar::Util, and its function "looks_like_number". The module is core, meaning it ships with Perl.


      Dave

      See looks_like_number in Scalar::Util like thus:

      use Scalar::Util qw(looks_like_number); for(qw(1 perl 25 monks)){ looks_like_number $_ ? print $_," is a Number",$/ : print $_," is not a Number",$/; }
      Update:
      Awooooshhhh! davido, beat me to it.....

      If you tell me, I'll forget.
      If you show me, I'll remember.
      if you involve me, I'll understand.
      --- Author unknown to me

        Yeah, but I left out the example, which you thoughtfully provided. ...or I left it as an exercise for the reader to figure out. ;)


        Dave

        hey

        what i want to do is that check whether the array cell has a number or not , if yes execute my block of code else not i.e.

        if( $array[$i] == number ) { my block of code ; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2026-04-13 17:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.