in reply to Special Variable Pattern Match whilst reading input from a file

while (<CONFIG_FILE>) { if(/^frz\s+=\s+(\w+)\;/) $bar = $1; } } print "$bar\n";
You can use the $n variables.