retrieving numbers.

J

Joe Smith

Chris said:
if ($input_string =~ /^([0-9]*) /) { $my_number = $1; }

Any particular reason why you chose [0-9] instead of \d ?
The repeat character + would be more suitable than * in this case.

if ($input_string =~ /^(\d+)/ { $my_number = $1; }

-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top