in reply to Re: Partial string match -- with a twist.
in thread Partial string match -- with a twist.

Revised code:

if ($key =~ m/(node[0-9]*)/) { if ($key = $1) { print "You entered " .$key. ":" . $ref->{$key}. "\n"; } }
That did the trick. Amazing how something so simple can be so easily missed. Thank you both very much.

Replies are listed 'Best First'.
Re^3: Partial string match -- with a twist.
by aitap (Curate) on Jul 20, 2012 at 14:16 UTC
    This form of matching is more common:
    if ($key =~ m/(node[0-9]*)/) { print "You entered " .$1. ":" . $ref->{$1}. "\n"; }
    Sorry if my advice was wrong.

      That works as well and is cleaner looking. Thanks to you as well. :)

      That works as well and is cleaner looking. Thanks!