in reply to Retrieving specific word from a line of text.

You just need to capture that section and assign it to the hash. A capture is indicated by parentheses, and the results are stored in $1 - $9. So, try:

if ($_ =~ m/.*(PNODE:\w*)/) # \w* assuming you want alphanumeric chars +. { $PNODES{$1} = 1; }

Replies are listed 'Best First'.
Re: Re: Retrieving specific word from a line of text.
by CountZero (Bishop) on Dec 11, 2002 at 22:46 UTC

    As a matter of fact you are not limited to 9 capture variables $1 - $9.
    Perl will make as many $x-variables as needed.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law