in reply to help related to regular expression

I do not know if I understand your question correctly. If you want to match a 'p' followed by some digits you can do it like this.

my $string = 'p23'; if($string =~ /[pP](\d+)/){ print $1 }'