![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Write a shell program to find the sum of alternate digits in a given 5-digit number | banta | Shell Programming and Scripting | 4 | 10-30-2006 01:59 AM |
| Validate Failure of SFTP in PERL | rahulrathod | Shell Programming and Scripting | 5 | 09-23-2005 08:37 PM |
| validate number range | sabina | Shell Programming and Scripting | 5 | 02-23-2005 10:26 AM |
| restrain the number of digits of a PID | mlefebvr | UNIX for Advanced & Expert Users | 1 | 05-27-2002 09:33 AM |
| a simple perl | gusla | UNIX for Dummies Questions & Answers | 3 | 04-17-2002 02:01 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
PERL: Simple reg expr validate 6 digits number
Hi there!
I'm trying to validate a simple 6 digits number with reg expr. I ONLY want 6 digits so when i type 7 digits the script should no validate the number. I've write this code: #!/usr/bin/perl while(<STDIN>){ if($_=~/\d{6}/){ print "Bingo!\n"; }else{ print "Error\n"; } } So when a type "123456" it validates well, when i type "1234567" ou "12345678" it validates too. Many thanks ! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|