in reply to Re^2: Regex: find all trailing numerical digits in a string
in thread Regex: find all trailing numerical digits in a string
It would seem to me that $& would be more readable than substr( $str, $-[0], $+[0] - $-[0] ).
use strict; while(<DATA>) { chomp; /\d+$/; print "Numeric: [$&]\n"; } __DATA__ asdf_sadf-3i897sdyf33987 3w45t-wevt453_838475693
Is there a case where you would use the substr over $&?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Regex: find all trailing numerical digits in a string
by dragonchild (Archbishop) on Dec 06, 2004 at 19:53 UTC | |
by Fletch (Bishop) on Dec 06, 2004 at 20:36 UTC |