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

open (CONFIG_FILE, "$config_file") || die LINE: while (<CONFIG_FILE>) { if ( /^frz\s+=\s+(\w+)\;/ ) { $bar = $1; } } print "$bar\n"; close (CONFIG_FILE) || die;
I'd like to note that currently bar will simply be set to the last matching line's value. Is that what you want? because you can also add a last LINE; expression, under $bar = $1, to tell perl you're done reading. You needn't go through the whole file, only up to the point where the line is.

-nuffin
zz zZ Z Z #!perl