The char class needs to be quantified:
$line =~ m/\s+([a-zA-Z0-9]+)$/;
or
$line =~ m/\s(\w+)$/;
For the second problem (or better for both) use split.
(Update: added more newlines)
In reply to Re: Two regex problems (easy)
by moritz
in thread Two regex problems (easy)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |