Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

m// Operator Help 1

Status
Not open for further replies.

kennygadams

Programmer
Joined
Jan 2, 2005
Messages
94
Location
US
Hi Perlies,

How is this done in Perl....

if($image_number =~ m/I need help in this area. This is where the account number is and can be anywhere from 1 to 7 digits long. How do you write 1 to 7 digits long with Perl?-\d\d\d\d-\d\d\d\d-\d\d\d\d/){}

Thanks in advance for your help.

Kenny Adams
 
Assuming that your testing to for the validity, then you need to use anchors as well.

Code:
if ($image_number =~ m/^\d{1,7}$/) {
    # Number 1 to 7 digits long.  No extra characters are allowed.
} else {
    # Put your error handling hear.
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top