in reply to Pattern matching
Dear stallion,
one advantage of perl is that you can try things out pretty fast. So you could just add a
to your snippet and see whether it works or not. And if it doesn't work at the beginning (it often doesn't), you could use that snippet to iteratively come to a solution. For example you could first try to extract the 3-digit-number.print "$output\n";
One hint: if you want to use $1, you need to capture (*) something from the regular expression. The things you want to capture should be written in round brackets ( ). Extracting the number at the end could look like
$array[$i] =~ /(\d+)$/;
HTH, Rata
* : see perlretut (section on extracting matches).
|
|---|