in reply to Extract the variable
It's not working because you're only replacing the first part, not the entire thing. Try this:
$var = ".declare book_num a13"; $var =~ s/^\.\w+\s+(\w+).*$/$1/g;
Or, forget the substitution:
$var = ".declare book_num a13"; $var =~ /^\.\w+\s+(\w+)/; print $1;
(Make sure to check that there /was/ a match, of course). If you haven't already, check out the relevant perldocs as well, such as perlretut.
Update: Whoops, ForgotPasswordAgain beat me to it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |