Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Validate array of numbers in sequence

by matsmats (Monk)
on Sep 08, 2003 at 09:17 UTC ( [id://289721]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @numlist = (1,2,3,4,5);
    if (join (",", @numlist ) eq join (",", (1..$#numlist+1))) {
    ...
    } else {
           print "incorrect";
    }
    
  2. or download this
    print ( (join (",", @numlist) eq join (",", (1..$#numlist+1))) ? "corr
    +ect" : "incorrect" );
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-19 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found